[Bug c++/100557] [ICE] Internal compiler error: Error reporting routines re-entered.

2021-05-11 Thread ldalessandro at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100557

--- Comment #1 from Luke Dalessandro  ---
Created attachment 50796
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50796=edit
Preprocessed source (bzipped for size)

[Bug c++/100557] New: [ICE] Internal compiler error: Error reporting routines re-entered.

2021-05-11 Thread ldalessandro at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100557

Bug ID: 100557
   Summary: [ICE] Internal compiler error: Error reporting
routines re-entered.
   Product: gcc
   Version: 11.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Not sure if this duplicates https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90747.


/home/ldalessa/open/ttl20/include/ttl/cpos.hpp:164:17: note:   template
argument deduction/substitution failed:
/home/ldalessa/open/ttl20/include/ttl/cpos.hpp:164:17: note: constraints not
satisfied
'
Internal compiler error: Error reporting routines re-entered.
0x677082 satisfaction_cache::get()
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:2668
0x67add5 satisfy_atom
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:2942
0x67add5 satisfy_constraint_r
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:3047
0x67b1ab satisfy_normalized_constraints
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:3072
0x67918b satisfy_declaration_constraints
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:3280
0x67918b constraint_satisfaction_value
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:3300
0x6790f0 constraint_satisfaction_value
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:3311
0x67b250 constraints_satisfied_p(tree_node*, tree_node*)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/constraint.cc:3337
0x7ad8d2 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/pt.c:21686
0x646839 add_template_candidate_real
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/call.c:3456
0x646fef add_template_candidate
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/call.c:3541
0x646fef add_candidates
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/call.c:6031
0x647527 add_candidates
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/call.c:4597
0x647527 perform_overload_resolution
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/call.c:4605
0x64b285 build_new_function_call(tree_node*, vec**, int)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/call.c:4679
0x7c17bc finish_call_expr(tree_node*, vec**, bool,
bool, int)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/semantics.c:2830
0x78ed56 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/pt.c:20518
0x7923c2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/pt.c:16223
0x7923c2 tsubst(tree_node*, tree_node*, int, tree_node*)
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/pt.c:16223
0x6cb421 dump_template_bindings
   
/tmp/ldalessa/spack-stage/spack-stage-gcc-11.1.0-iti6b3aunvr257imqro4hr6gsq2rc4h6/spack-src/gcc/cp/error.c:446

[Bug debug/100515] [12 Regression] ICE in output_rnglists, at dwarf2out.c:12294 since r12-574-ge69ac0203725fb8d

2021-05-11 Thread edlinger at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100515

--- Comment #4 from Bernd Edlinger  ---
Created attachment 50795
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50795=edit
Proposed patch

This is what I'm currently testing.

[Bug c/100556] New: ICE: in gimplify_expr, at gimplify.c:14868

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100556

Bug ID: 100556
   Summary: ICE: in gimplify_expr, at gimplify.c:14868
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.BriefQJ2R3-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:61d4686bb:71d38ec80008afdbb9a059253407d80598b765c0] (GCC)

$ cat mutant.c
f2() { return __transaction_atomic(f() == 0); }

$ gcc-trunk -O0 mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | f2() { return __transaction_atomic(f() == 0); }
  | ^~
mutant.c: In function ‘f2’:
mutant.c:1:36: warning: implicit declaration of function ‘f’; did you mean
‘f2’? [-Wimplicit-function-declaration]
1 | f2() { return __transaction_atomic(f() == 0); }
  |^
  |f2
mutant.c:1:15: error: ‘__transaction_atomic’ without transactional memory
support enabled
1 | f2() { return __transaction_atomic(f() == 0); }
  |   ^~~~
mutant.c:1:36: internal compiler error: in gimplify_expr, at gimplify.c:14868
1 | f2() { return __transaction_atomic(f() == 0); }
  |^~~
0x6daa38 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14868
0xc24eb1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14838
0xc2531f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14388
0xc358b7 gimplify_modify_expr
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:5818
0xc25118 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14083
0xc28a4a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2927e gimplify_bind_expr
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:1421
0xc254b3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14284
0xc28a4a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:6877
0xc27bf8 gimplify_and_add(tree_node*, gimple**)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:489
0xc27bf8 gimplify_and_return_first
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:501
0xc27bf8 gimplify_transaction
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:13703
0xc27bf8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14711
0xc358b7 gimplify_modify_expr
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:5818
0xc25118 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14083
0xc28a4a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:6877
0xc341ed gimplify_and_add(tree_node*, gimple**)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:489
0xc341ed gimplify_return_expr
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:1671
0xc25dbf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:14345
0xc28a4a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.BriefQJ2R3-gcc-builder/gcc/gcc/gimplify.c:6877
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug fortran/100555] New: [OPENMP] ICE in target parallel construct with if-clause

2021-05-11 Thread xiao.liu--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100555

Bug ID: 100555
   Summary: [OPENMP] ICE in target parallel construct with
if-clause
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xiao@compiler-dev.com
  Target Milestone: ---

The test case is,

program test
  use omp_lib
  integer :: i
  i = 1
!!$omp target parallel if(target: i > 0) if(parallel: i > 0)  !ICE
!!$omp target parallel if(target: i > 0)
!!$omp target parallel if(parallel: i > 0) !ICE
!!$omp target parallel if(i > 0) !ICE
!$omp target parallel
  print *, "thread id = ", omp_get_thread_num()
!$omp end target parallel
end program

It seems that when exist if-clause applies to parallel directive, there is an
ICE.

If change target parallel construct to target parallel loop construct, there is
no ICE.

[Bug fortran/94331] Bind(C) corrupts array descriptors

2021-05-11 Thread sandra at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94331

sandra at gcc dot gnu.org changed:

   What|Removed |Added

 CC||sandra at gcc dot gnu.org

--- Comment #3 from sandra at gcc dot gnu.org ---
I think this is probably a duplicate of PR93308, but there are so many things
going on in the test case I can't be sure there aren't other problems lurking
as well.

[Bug rtl-optimization/100554] New: [9/10/11/12 Regression] -fcompare-debug failure w/ -Os -fmodulo-sched -fno-tree-loop-optimize

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

Bug ID: 100554
   Summary: [9/10/11/12 Regression] -fcompare-debug failure w/ -Os
-fmodulo-sched -fno-tree-loop-optimize
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: asolokha at gmx dot com
  Target Milestone: ---
Target: aarch64-linux-gnu

gcc-12.0.0-alpha20210509 snapshot (g:5e0236d3b0e0d7ad98bcee36128433fa755b5558),
11.1, 10.3, 9.3 fail -fcompare-debug when compiling the following testcase w/
-Os -fmodulo-sched -fno-tree-loop-optimize:

int __attribute__ ((simd))
foo (int x)
{
  return x;
}

% aarch64-linux-gnu-gcc-12.0.0 -Os -fcompare-debug -fmodulo-sched
-fno-tree-loop-optimize -c cn8zanql.c
aarch64-linux-gnu-gcc-12.0.0: error: cn8zanql.c: '-fcompare-debug' failure

--- cn8zanql.c.gkd  2021-05-12 10:02:59.380096724 +0700
+++ cn8zanql.gk.c.gkd   2021-05-12 10:02:59.414096616 +0700
@@ -669,6 +669,7 @@
  (nil))
 (code_label # 0 0 13 (nil) [1 uses])
 (note # 0 0 [bb 3] NOTE_INSN_BASIC_BLOCK)
+(note # 0 0 NOTE_INSN_DELETED)
 (insn # 0 0 (set (reg:DI 3 x3)
 (zero_extend:DI (mem:SI (plus:DI (reg/f:DI 5 x5 [103])
 (reg:DI 1 x1 [99])) [ D.[iter.14_3]+0 S4 A32])))
"cn8zanql.c":4:10# {*zero_extendsidi2_aarch64}
@@ -679,7 +680,6 @@
  (expr_list:REG_DEAD (reg:SI 3 x3 [orig:104 D.[iter.14_3] ] [104])
 (expr_list:REG_DEAD (reg:DI 1 x1 [99])
 (nil
-(note # 0 0 NOTE_INSN_DELETED)
 (insn # 0 0 (set (reg:DI 1 x1 [99])
 (and:DI (ashift:DI (reg:DI 0 x0 [orig:93 D. ] [93])
 (const_int 2 [0x2]))

Is it an issue at all? Should I report more issues of this kind in the future?

[Bug c++/100553] New: [constexpr] new/delete matching fails when ref-counted pointers are stored in arrays

2021-05-11 Thread ldalessandro at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100553

Bug ID: 100553
   Summary: [constexpr] new/delete matching fails when ref-counted
pointers are stored in arrays
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Sorry about the complexity of this test case. Consider the following code.

```
#include 

struct Node {
int count = 0;
constexpr virtual void destroy() const = 0; // workaround
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100495
};

struct node_ptr
{
Node *ptr_;

constexpr ~node_ptr()
{
  dec();
}

constexpr node_ptr(node_ptr const& b)
: ptr_(b.ptr_)
{
  inc();
}

constexpr node_ptr(node_ptr&& b)
: ptr_(std::exchange(b.ptr_, nullptr))
{
}

constexpr node_ptr(Node *ptr)
: ptr_(ptr)
{
  inc();
}

constexpr node_ptr& operator=(Node* b)
{
  if (b) {
++b->count;
  }
  dec();
  ptr_ = b;
  return *this;
}

constexpr void inc() const
{
  if (ptr_) {
++ptr_->count;
  }
}

constexpr void dec()
{
  if (ptr_) {
if (--ptr_->count == 0) {
  std::exchange(ptr_, nullptr)->destroy();
}
  }
}
};

struct Unary : Node
{
node_ptr children[1] = { nullptr };
node_ptr a = nullptr;

constexpr void destroy() const override
{
delete this;
}
};

#ifdef ARRAY // fails
#define a(node) node->children[0]
#else
#define a(node) node->a
#endif

struct Tree 
{
Unary c;
constexpr Tree(node_ptr const& tree) {
std::construct_at(, static_cast(*tree.ptr_));
a(()) = nullptr;
}
};

constexpr node_ptr foo() {
Unary *node = new Unary;
a(node) = new Unary;
return node;
}

constexpr Tree tree = foo(); // error: use of allocated storage after
deallocation in a constant expression
```

This is a fragment of some tree code that I'm using and includes a base Node*
type with a count for an intrusive node_ptr reference counted pointer. There is
one derived type, Unary, that stores a single node_ptr, either as an ARRAY or
as a scalar member. The tree stores a single Unary node.

There's a macro for the sake of the test case, -DARRAY uses the array member.
When I use the array member gcc-trunk fails to match the new/deletes, while its
fine with the scalar member. Clang compiles both without error.

https://godbolt.org/z/oGc1qTvvo

[Bug middle-end/100537] Bootstrap-O3 and bootstrap-debug fail on 32-bit ARM after gcc-12-657-ga076632e274a

2021-05-11 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100537

Jiu Fu Guo  changed:

   What|Removed |Added

 CC||guojiufu at gcc dot gnu.org

--- Comment #3 from Jiu Fu Guo  ---
This issue also occurs on ppc64le when --with-build-config=bootstrap-O3.

As mentioned in PR100513:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513#c21

[Bug lto/96455] Partial Linking (-r) with LTO issue

2021-05-11 Thread dongjianqiang2 at huawei dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96455

John Dong  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from John Dong  ---
closed

[Bug bootstrap/100552] New: configure: 32208: Syntax error: Bad substitution

2021-05-11 Thread ibuclaw at gdcproject dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100552

Bug ID: 100552
   Summary: configure: 32208: Syntax error: Bad substitution
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: bootstrap
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

When building on x86_64--netbsd

The introducing change looks to be r11-6196.  In particular, the substitution
on this line using bash-specific features:

CROSS_TEST_CXXFLAGS="-nostdinc ${XGCC_FLAGS_FOR_TARGET//-B/-idirafter/}"

[Bug middle-end/100477] Bogus -Wstringop-overflow warning on memset

2021-05-11 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100477

--- Comment #8 from Martin Sebor  ---
The PTRDOIFF_MAX limit is a general restriction implied by the language
requirement that the difference between any two pointers must be representable
in ptrdiff_t.  In practical terms, GCC internally represents pointer offsets in
a type like ptrdiff_t so all pointer expressions are so restricted.  To enforce
the restriction and prevent bugs, GCC rejects declarations of larger types or
objects with an error, and issues warnings for attempts to create others
(malloc, VLAs).  Most LP64 systems (all major Linux distributions) have much
lower limits still (see for example
https://access.redhat.com/articles/rhel-limits).  Calls to malloc() fail with
sizes far smaller than that, the stack cannot grow to accommodate them, etc.,
so any access of that size is inevitably an error (solutions like PAE are bound
to run into the GCC internal limitation).

As for the alloc_string() example, there is no way to differentiate between the
two kinds of cases you mention.  A single code path can be split into two or
more with constants propagated into each, rendering one or the other
unconditionally invalid even when the original code is valid for a subset of
operand values.  This is a limitation inherent to all flow-based GCC warnings
(those that depend on optimization).  The static analyzer (-fanalyzer) doesn't
depend on optimization so it's not prone to this effect.

Submitting a bug for the LTO problem is only helpful if it comes with a test
case to reproduce it.  I have heard about problems suppressing warnings in LTO
builds but I'm not aware of it being a design limitation, and other than the
mention of the inlining caveat (the -Wstringop-overflow example) I can't find
it mentioned in the LTO section of the manual pointed to by the link.

[Bug web/100480] Where to file complaints re project-maintainers?

2021-05-11 Thread mrs at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100480

mrs at gcc dot gnu.org  changed:

   What|Removed |Added

 CC||mrs at gcc dot gnu.org
 Resolution|--- |WORKSFORME
 Status|UNCONFIRMED |RESOLVED

--- Comment #5 from mrs at gcc dot gnu.org  ---
gcc is a volunteer project.  No one is paid to read complaints.  If you would
like to volunteer to read and handle complaints, we can create a bug category
called complaints, we could then document it.  Aside from that, there is only
the gcc list, and that is already documented on the web site at:

  https://gcc.gnu.org/lists.html

https://lists.gnu.org/mailman/listinfo/gnu-misc-discuss is a fine (public)
place to discuss the bug bounty program and how it interacts with the gcc
project.  This is documented on the gnu.org web site.

[Bug inline-asm/100542] ICE: segmentation fault, at is_gimple_variable with void type statement expression

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100542

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #2 from Andrew Pinski  ---
Same as PR 100501.

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

[Bug c/100501] ICE: segmentation fault on embedded asm code

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100501

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

[Bug c/100528] ICE: tree check: expected string_cst, have plus_expr in get_attr_len, at multiple_target.c:198

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100528

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
Same problem as PR 100504.

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

[Bug c/100504] ICE: tree check: expected string_cst, have integer_cst in get_attr_len, at multiple_target.c:198

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100504

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

[Bug c/100531] ICE: tree check: expected string_cst, have ne_expr in get_attr_len, at multiple_target.c:198

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100531

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
same problem as PR 100504.

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

[Bug c/100504] ICE: tree check: expected string_cst, have integer_cst in get_attr_len, at multiple_target.c:198

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100504

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

[Bug c/100504] ICE: tree check: expected string_cst, have integer_cst in get_attr_len, at multiple_target.c:198

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100504

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

[Bug c/100534] ICE: internal compiler error with a bad argument to the target_clones attribute

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100534

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #1 from Andrew Pinski  ---
This is the same problem as PR 100504.

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

[Bug c/100550] [11/12 Regression] ICE: in fold_convert_loc with function call VLA argument

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100550

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-05-11
 Status|UNCONFIRMED |NEW

--- Comment #2 from Andrew Pinski  ---
.

[Bug c/100550] [11/12 Regression] ICE: in fold_convert_loc with function call VLA argument

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100550

Andrew Pinski  changed:

   What|Removed |Added

Summary|ICE: in fold_convert_loc,   |[11/12 Regression] ICE: in
   |at fold-const.c:2429|fold_convert_loc with
   ||function call VLA argument
   Target Milestone|--- |11.2
   Severity|normal  |trivial

--- Comment #1 from Andrew Pinski  ---
Note this is a regression from GCC 10 which did not ICE.
It was most likely introduced while the [*] support was being added.

[Bug middle-end/100536] ICE: in expand_call with large union (1GB) argument

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100536

--- Comment #1 from Andrew Pinski  ---
This most likely should really be rejected as over 1GB argument size is HUGE.

[Bug c/93239] Enhancement: allow unevaluated statement expressions at filescope

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93239

Andrew Pinski  changed:

   What|Removed |Added

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

--- Comment #3 from Andrew Pinski  ---
PR 17854 mentions we should allow them always (at least in the C++ case).

[Bug inline-asm/100542] ICE: segmentation fault, at is_gimple_variable with void type statement expression

2021-05-11 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100542

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
  Component|c   |inline-asm
Summary|ICE: segmentation fault, at |ICE: segmentation fault, at
   |is_gimple_variable, |is_gimple_variable with
   |gimple-expr.h:84|void type statement
   ||expression
Version|tree-ssa|12.0

--- Comment #1 from Andrew Pinski  ---
This most likely should have been rejected as invalid.  a void type statement
expression cannot be an operand to a inline-asm statement.

[Bug fortran/100551] New: [11/12 Regression] Passing return value of intrinsic to class(*) dummy argument can cause segfaults

2021-05-11 Thread bugs at colin dot moe via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100551

Bug ID: 100551
   Summary: [11/12 Regression] Passing return value of intrinsic
to class(*) dummy argument can cause segfaults
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bugs at colin dot moe
  Target Milestone: ---

Created attachment 50794
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50794=edit
Minimum working example that induces the error.

When passing the return value of an intrinsic function (and possibly other
temporaries) into a function with a class(*) dummy argument, the resulting code
will generate a segfault in GCC 11.1 and newer.  10.2 and earlier (as early as
4.8.5 tested) worked correctly.

Minimum working example attached.

GCC Version (latest tested):

Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib
--enable-languages=c,c++,fortran --with-system-zlib --prefix=[]/gcc-12.0
gcc version 12.0.0 20210511 (experimental) (GCC) 

Command line:
gfortran -Wall -Wextra mwe.f90
./a.out

Output:
Compiler builds with no issues.  In GCC 4.8.5, 9.3.0, 10.2.0, the program
output is:
15

In 11.1.0 and 12.0 (tested against master branch for 12.0):
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f6e7a218f7f in ???
#1  0x401323 in __testmod_MOD_test
at []/mwe.f90:15
#2  0x4015b2 in testprogram
at []/mwe.f90:26
#3  0x40165b in main
at []/mwe.f90:18
[1]626265 segmentation fault (core dumped)  ./a.out

Output with -fsanitize=undefined:
mwe.f90:15:10: runtime error: member access within misaligned address
0x7ffc6198b024 for type 'struct __class__STAR_t', which requires 8 byte
alignment
0x7ffc6198b024: note: pointer points here
  60 49 30 ef 0f 00 00 00  00 00 00 00 00 00 00 00  01 00 00 00 02 00 00 00  03
00 00 00 04 00 00 00
  ^

[Bug c/100550] New: ICE: in fold_convert_loc, at fold-const.c:2429

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100550

Bug ID: 100550
   Summary: ICE: in fold_convert_loc, at fold-const.c:2429
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
void f1ipx();
void f1ia_f(int[]);
void f1ia_f(int[f1ipx()]);

$ gcc-trunk -O0 mutant.c
mutant.c:3:16: error: size of unnamed array has non-integer type
3 | void f1ia_f(int[f1ipx()]);
  |^
mutant.c:3:1: internal compiler error: in fold_convert_loc, at
fold-const.c:2429
3 | void f1ia_f(int[f1ipx()]);
  | ^~~~
0x6bd71f fold_convert_loc(unsigned int, tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/fold-const.c:2429
0x11fec86 build_range_type_1
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:7015
0x8c8e5b attr_access::array_as_string[abi:cxx11](tree_node*) const
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/attribs.c:2392
0x9d8915 warn_parm_array_mismatch(unsigned int, tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-warn.c:3448
0x943e4c c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2342
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100549] New: ICE: Segmentation fault, gsi_insert_seq_nodes_before, during GIMPLE pass: lower

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100549

Bug ID: 100549
   Summary: ICE: Segmentation fault, gsi_insert_seq_nodes_before,
during GIMPLE pass: lower
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
typedef short v8hi __attribute__((vector_size(16)));
f6(v8hi a) { __builtin_ia32_pcmpgtw128(a, a); }

$ gcc-trunk -O0 mutant.c
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | f6(v8hi a) { __builtin_ia32_pcmpgtw128(a, a); }
  | ^~
during GIMPLE pass: lower
mutant.c: In function ‘f6’:
mutant.c:2:1: internal compiler error: Segmentation fault
0xef7273 crash_signal
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/toplev.c:327
0xbebb17 gsi_insert_seq_nodes_before
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-iterator.c:130
0x12a30c6 ix86_gimple_fold_builtin(gimple_stmt_iterator*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/config/i386/i386.c:18003
0xc01508 gimple_fold_call
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-fold.c:5586
0xc0288b fold_stmt_1
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-fold.c:6283
0x19177c3 lower_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:388
0x19177c3 lower_sequence
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:217
0x191766d lower_gimple_bind
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:473
0x191852d lower_function_body
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:110
0x191852d execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:195
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug analyzer/100548] New: No GCC equivalent of built-in predefined macro __clang_analyzer__

2021-05-11 Thread andrew at ishiboo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100548

Bug ID: 100548
   Summary: No GCC equivalent of built-in predefined macro
__clang_analyzer__
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: andrew at ishiboo dot com
  Target Milestone: ---

I scanned the `-fanalyzer -dM -E` output and there does not appear to be any
built-in predefined macro to indicate that it is being evaluated by the
analyzer. Clang defines the `__clang_analyzer__` built-in documented here:
https://clang-analyzer.llvm.org/faq.html#exclude_code

Can this be added?

[Bug c/100547] New: ICE with "-g -O1": Segmentation fault signal terminated program cc1, during RTL pass: expand

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100547

Bug ID: 100547
   Summary: ICE with "-g -O1": Segmentation fault signal
terminated program cc1, during RTL pass: expand
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
typedef __attribute__((vector_size(
((8 * sizeof(short)) * sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short)) *
   sizeof(short)) *
  sizeof(short)) *
 sizeof(short)) *
sizeof(short V;
k() { V w = {}; }

$ gcc-trunk -O1 -g mutant.c
mutant.c:31:22: warning: type defaults to ‘int’ in declaration of ‘V’
[-Wimplicit-int]
   31 | sizeof(short V;
  |  ^
mutant.c:32:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   32 | k() { V w = {}; }
  | ^
during RTL pass: expand
gcc-trunk: internal compiler error: Segmentation fault signal terminated
program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug analyzer/100546] New: -Wanayzer-null-dereference false positive through noreturn function pointer

2021-05-11 Thread andrew at ishiboo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100546

Bug ID: 100546
   Summary: -Wanayzer-null-dereference false positive through
noreturn function pointer
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: andrew at ishiboo dot com
  Target Milestone: ---

Test case:

$ cat /tmp/test.cpp
#include 
#include 

static void noReturn(const char *str) __attribute__((noreturn));
static void noReturn(const char *str) {
printf("%s\n", str);
exit(1);
}

void (*noReturnPtr)(const char *str) = 

int main(int argc, char **argv) {
char *str = 0;
if (!str)
noReturnPtr(__FILE__);
return printf("%c\n", *str);
}

Output:

$ g++-11 -fanalyzer -c /tmp/test.cpp
/tmp/test.cpp: In function 'int main(int, char**)':
/tmp/test.cpp:16:27: warning: dereference of NULL 'str' [CWE-476]
[-Wanalyzer-null-dereference]
   16 | return printf("%c\n", *str);
  |   ^~~~
  'int main(int, char**)': events 1-4
|
|   13 | char *str = 0;
|  |   ^~~
|  |   |
|  |   (1) 'str' is NULL
|   14 | if (!str)
|  | ~~ 
|  | |
|  | (2) following 'true' branch (when 'str' is NULL)...
|   15 | noReturnPtr(__FILE__);
|  | ~
|  ||
|  |(3) ...to here
|   16 | return printf("%c\n", *str);
|  |   
|  |   |
|  |   (4) dereference of NULL 'str'
|

[Bug c/100545] New: ICE with -g: in gen_typedef_die, at dwarf2out.c:25714

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100545

Bug ID: 100545
   Summary: ICE with -g: in gen_typedef_die, at dwarf2out.c:25714
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
typedef __attribute__((mode(SI))) fatp_t __attribute__((aligned));

$ gcc-trunk -g mutant.c
mutant.c:1:35: warning: type defaults to ‘int’ in declaration of ‘fatp_t’
[-Wimplicit-int]
1 | typedef __attribute__((mode(SI))) fatp_t __attribute__((aligned));
  |   ^~
mutant.c:1:1: internal compiler error: in gen_typedef_die, at dwarf2out.c:25714
1 | typedef __attribute__((mode(SI))) fatp_t __attribute__((aligned));
  | ^~~
0x6a6c97 gen_typedef_die
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:25714
0x6a6c97 gen_typedef_die
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:25686
0xb1d4b9 gen_decl_die
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:26718
0xb1ec96 dwarf2out_decl
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:27270
0xb1f180 dwarf2out_type_decl
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:26988
0xb1f180 dwarf2out_type_decl
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:26983
0xe0a48a rest_of_decl_compilation(tree_node*, int, int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/passes.c:251
0x8dffe7 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-decl.c:5603
0x9431ab c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2370
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100544] New: ICE: in default_conversion, at c/c-typeck.c:2242

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100544

Bug ID: 100544
   Summary: ICE: in default_conversion, at c/c-typeck.c:2242
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

This might be a duplicate of PR 90658

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
void A();
void fn4() __attribute__((destructor(A)));

$ gcc-trunk  mutant.c
mutant.c:2:1: internal compiler error: in default_conversion, at
c/c-typeck.c:2242
2 | void fn4() __attribute__((destructor(A)));
  | ^~~~
0x6415e4 default_conversion(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-typeck.c:2242
0x9c5a4a get_priority
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-attribs.c:1824
0x9c7af1 handle_destructor_attribute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-attribs.c:1905
0x8c9f06 decl_attributes(tree_node**, tree_node*, int, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/attribs.c:723
0x8e63ae start_decl(c_declarator*, c_declspecs*, bool, tree_node*, unsigned
int*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-decl.c:5198
0x94314d c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2302
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug analyzer/100543] New: -Wanalyzer-free-of-non-heap false positive / delete false positive due to constructor conditional

2021-05-11 Thread andrew at ishiboo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100543

Bug ID: 100543
   Summary: -Wanalyzer-free-of-non-heap false positive / delete
false positive due to constructor conditional
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: andrew at ishiboo dot com
  Target Milestone: ---

# Test case:

#include 
#include 
#include 

struct Assert {
[[ noreturn ]] static void noReturn();
};

template 
union ObjectBuffer {
  private:
char   d_buffer[sizeof(TYPE)];
double d_align;
  public:
char *buffer() { return d_buffer; }
TYPE& object() { return *reinterpret_cast(this); }
};

struct Foo {
char *d_buf;
unsigned d_sz;

Foo(char *buf, unsigned sz) : d_buf(buf), d_sz(sz) {
#ifdef ANALYZER_FAILURE
if (0 == d_buf) Assert::noReturn();
if (0 == d_sz)  Assert::noReturn();
#endif
}

char *allocate(unsigned) { return d_buf; }
};

int main(int argc, char **argv) {
ObjectBuffer objectBuffer;
char buf[sizeof(Foo)];
void *ptr = new (objectBuffer.buffer()) Foo(buf, sizeof(buf));
return printf("%p\n", static_cast(ptr)->allocate(1));
}

## Output:

Works just fine:
$ g++-11 -fanalyzer -c /tmp/test.cpp

Fails:
$ g++-11 -DANALYZER_FAILURE -fanalyzer -c /tmp/test.cpp
/tmp/test.cpp: In function 'int main(int, char**)':
/tmp/test.cpp:36:65: warning: 'delete' of '&
objectBuffer.ObjectBuffer::d_buffer' which points to memory not on the
heap [CWE-590] [-Wanalyzer-free-of-non-heap]
   36 | void *ptr = new (objectBuffer.buffer()) Foo(buf, sizeof(buf));
  | ^
  'int main(int, char**)': events 1-2
|
|   33 | int main(int argc, char **argv) {
|  | ^~~~
|  | |
|  | (1) entry to 'main'
|..
|   36 | void *ptr = new (objectBuffer.buffer()) Foo(buf, sizeof(buf));
|  |  ~
|  | |
|  | (2) calling
'ObjectBuffer::buffer' from 'main'
|
+--> 'char* ObjectBuffer::buffer() [with TYPE = Foo]': events 3-4
   |
   |   15 | char *buffer() { return d_buffer; }
   |  |   ^~
   |  |   | |
   |  |   | (4) pointer is from here
   |  |   (3) entry to 'ObjectBuffer::buffer'
   |
<--+
|
  'int main(int, char**)': events 5-6
|
|   36 | void *ptr = new (objectBuffer.buffer()) Foo(buf, sizeof(buf));
|  |  ~~~^~  ~
|  | |   |
|  | |  
(6) calling 'Foo::Foo' from 'main'
|  | (5) returning to 'main'
from 'ObjectBuffer::buffer'
|
+--> 'Foo::Foo(char*, unsigned int)': events 7-11
   |
   |   23 | Foo(char *buf, unsigned sz) : d_buf(buf), d_sz(sz) {
   |  | ^~~
   |  | |
   |  | (7) entry to 'Foo::Foo'
   |   24 | #ifdef ANALYZER_FAILURE
   |   25 | if (0 == d_buf) Assert::noReturn();
   |  | ~~
   |  | |
   |  | (8) following 'false' branch...
   |   26 | if (0 == d_sz)  Assert::noReturn();
   |  | ~~   
   |  | ||
   |  | |(9) ...to here
   |  | (10) following 'false' branch...
   |   27 | #endif
   |   28 | }
   |  | ~
   |  | |
   |  | (11) ...to here
   |
<--+
|
  'int main(int, char**)': events 12-13
|
|   36 | void *ptr = new (objectBuffer.buffer()) Foo(buf, sizeof(buf));
|  | ^
|  | |
|  |
(12) returning to 'main' from 'Foo::Foo'
|  |
(13) call to 'delete' here
|

## Info:

"(13) call to 'delete' here" makes no sense. The entire thing is only triggered
by the presence of either conditional on line 25/26. If the conditional
branches are removed, it compiles fine.

[Bug c/100542] New: ICE: segmentation fault, at is_gimple_variable, gimple-expr.h:84

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100542

Bug ID: 100542
   Summary: ICE: segmentation fault, at is_gimple_variable,
gimple-expr.h:84
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
ldt_add_entry()
{
__asm__ ( "" : : "m" ( ( { } ) ) ) ;
}

$ gcc-trunk  mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | ldt_add_entry()
  | ^
mutant.c: In function ‘ldt_add_entry’:
mutant.c:3:26: internal compiler error: Segmentation fault
3 | __asm__ ( "" : : "m" ( ( { } ) ) ) ;
  |~~^
0xef7273 crash_signal
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/toplev.c:327
0xbeacd4 is_gimple_variable
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.h:84
0xbeacd4 is_gimple_id
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.h:95
0xbeacd4 is_gimple_addressable
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.h:122
0xbeacd4 is_gimple_lvalue(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:595
0xc273cd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15038
0xc30a1d gimplify_asm_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6506
0xc26705 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14416
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2979e gimplify_bind_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:1421
0xc259d3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14284
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2a563 gimplify_body(tree_node*, bool)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15328
0xc2a9b1 gimplify_function_tree(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15482
0xa7e707 cgraph_node::analyze()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:670
0xa81611 analyze_functions
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xa820e1 symbol_table::finalize_compilation_unit()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2508
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug fortran/100440] allocated() gives True for unallocated variable

2021-05-11 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100440

--- Comment #12 from anlauf at gcc dot gnu.org ---
A small variation of the testcase in comment#9 suggests that there are
actually two underlying issues: lack of initialization and a missing
temporary.

program p
  implicit none
  type fm
 real, allocatable :: mp(:)
 integer   :: dummy = 42
  end type
  type(fm), allocatable :: a(:), b(:)
  integer :: n = 1
  allocate (a(n))
  print *, "main:", n, allocated (a(n)% mp), a(n)% dummy
  b = mm (a)
  a = mm (b)
  a = mm (a)
  a = mm (a) ! crashes here with -fsanitize=address
contains
  function mm (ma)
type(fm), intent(in) :: ma(:)
type(fm) :: mm(size(ma))
integer  :: i
!   type(fm) :: z(size(ma))
!   mm = z  ! Explicit initialization of function result
do i = 1, size(ma)
   print *, "in mm:", i, allocated (mm(i)% mp), mm(i)% dummy
end do
  end function mm
end program p

This gives:

 main:   1 F  42
 in mm:   1 F   0
 in mm:   1 F  42
 in mm:   1 F   0
 in mm:   1 T   0

while with -fsanitize=address,undefined :

 main:   1 F  42
 in mm:   1 F -1094795586
 in mm:   1 F  42
 in mm:   1 T -1094795586
 in mm:   1 T -1094795586

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x14987da6f49f in ???
[...]
#6  0x409669 in p
at /home/anlauf/gcc-bugs/pr100440-red3.f90:14
#7  0x4097d9 in main
at /home/anlauf/gcc-bugs/pr100440-red3.f90:14

[Bug c++/99032] GCC accepts attributes on friend declarations (not definitions)

2021-05-11 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99032

--- Comment #2 from Marek Polacek  ---
Current test:

class X { };
template
void foo (T1, T2);

struct S {
  [[deprecated]] friend void f(); // error
  [[deprecated]] friend void f2() { }
  friend void f3 [[deprecated]] (); // error
  friend void f4 [[deprecated]] () { }
  [[deprecated]] friend void; // error
  [[deprecated]] friend X; // error
  [[deprecated]] friend class N; // error
  friend class [[deprecated]] N2; // error
  [[deprecated]] friend void foo<>(int, int); // error
  // FIXME: When PR100339 is resolved.
  //[[deprecated]] friend void ::foo(int, int); // error
};

template
class node { };

template
struct A {
  [[deprecated]] friend T; // error
  [[deprecated]] friend class node; // we warn
  template
  [[deprecated]] friend class A; // we warn
  template
  [[deprecated]] friend void bar () { } // OK
  template
  [[deprecated]] friend void baz (); // error
};

[Bug middle-end/21433] The COMPONENT_REF case of expand_expr_real_1 is probably wrong

2021-05-11 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21433

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #6 from Martin Sebor  ---
Fixed in r12-728.

[Bug libstdc++/99453] libstdc++*-gdb.py installation depends on library naming

2021-05-11 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99453

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|12.0|11.2

[Bug middle-end/21433] The COMPONENT_REF case of expand_expr_real_1 is probably wrong

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21433

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

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

commit r12-728-gde09c0ddb81e2dc0e35c2e362532e93ca417200c
Author: Martin Sebor 
Date:   Tue May 11 13:58:48 2021 -0600

Replace unreachable code with an assert.

Resolves:
PR middle-end/21433 - The COMPONENT_REF case of expand_expr_real_1 is
probably wrong

gcc/ChangeLog:

PR middle-end/21433
* expr.c (expand_expr_real_1): Replace unreachable code with an
assert.

[Bug fortran/100440] allocated() gives True for unallocated variable

2021-05-11 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100440

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 CC||anlauf at gcc dot gnu.org

--- Comment #11 from anlauf at gcc dot gnu.org ---
For a possibly related case see PR98454.

[Bug libstdc++/78052] [5/6/7 Regression] allocator_traits> partial specialization vs allocator

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78052

--- Comment #6 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

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

commit r11-8397-gdb9dec545bf7c5be3120412444553ff993c7200d
Author: Jonathan Wakely 
Date:   Tue May 11 15:01:01 2021 +0100

libstdc++: Fix missing members in std::allocator

The changes in 75c6a925dab5b7af9ab47c10906cb0e140261cc2 were slightly
incorrect, because the converting constructor should be noexcept, and
the POCMA and is_always_equal traits should still be present in C++20.
This fixes it, and slightly refactors the preprocessor conditions and
order of members. Also add comments explaining things.

The non-standard construct and destroy members added for PR 78052 can be
private if allocator_traits> is made a friend.

libstdc++-v3/ChangeLog:

* include/bits/allocator.h (allocator) [C++20]: Add
missing noexcept to constructor. Restore missing POCMA and
is_always_equal_traits.
[C++17]: Make construct and destroy members private and
declare allocator_traits as a friend.
* include/bits/memoryfwd.h (allocator_traits): Declare.
* include/ext/malloc_allocator.h (malloc_allocator::allocate):
Add nodiscard attribute. Add static assertion for LWG 3307.
* include/ext/new_allocator.h (new_allocator::allocate): Add
static assertion for LWG 3307.
* testsuite/20_util/allocator/void.cc: Check that converting
constructor is noexcept. Check for propagation traits and
size_type and difference_type. Check that pointer and
const_pointer are gone in C++20.

(cherry picked from commit 5e3a1ea3d89d62972e1f036b2ede37a80b880bdf)

[Bug middle-end/93100] gcc -fsanitize=address inhibits -Wuninitialized

2021-05-11 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93100

Martin Sebor  changed:

   What|Removed |Added

   Target Milestone|--- |12.0
  Known to fail|11.0|11.1.0, 12.0
   Keywords||patch

--- Comment #4 from Martin Sebor  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570117.html

[Bug middle-end/98583] missing -Wuninitialized reading from a second VLA in its own block

2021-05-11 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98583

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch
   Target Milestone|--- |12.0
 Status|NEW |ASSIGNED
  Known to fail||10.3.0, 11.1.0, 12.0, 9.2.0
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570117.html

[Bug libstdc++/99006] make_shared silently works

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99006

--- Comment #5 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
:

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

commit r11-8382-gddfba2359d57167ed7a1efd184cae0cd5be2f31b
Author: Jonathan Wakely 
Date:   Thu Apr 22 15:46:51 2021 +0100

libstdc++: Reject std::make_shared [PR 99006]

Prior to C++20 it should be ill-formed to use std::make_shared with an
array type (and we don't support the C++20 feature to make it valid yet
anyway).

libstdc++-v3/ChangeLog:

PR libstdc++/99006
* include/bits/shared_ptr.h (allocate_shared): Assert that _Tp
is not an array type.
* include/bits/shared_ptr_base.h (__allocate_shared): Likewise.
* testsuite/20_util/shared_ptr/creation/99006.cc: New test.

(cherry picked from commit 55650236cd97d81f42f9fdb4f6bcb12babafe51f)

[Bug libstdc++/99453] libstdc++*-gdb.py installation depends on library naming

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99453

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

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

commit r11-8381-gdbb87d6a9c37c8eca80d77782717a8144515c16d
Author: Philippe Blain 
Date:   Fri Mar 12 19:26:46 2021 -0500

libstdc++: Install libstdc++*-gdb.py more robustly [PR 99453]

In order for GDB to auto-load the pretty printers, they must be installed
as "libstdc++.$ext-gdb.py", where 'libstdc++.$ext' is the name of the
object file that is loaded by GDB [1], i.e. the libstdc++ shared library.

The approach taken in libstdc++-v3/python/Makefile.am is to loop over
files matching 'libstdc++*' in $(DESTDIR)$(toolexeclibdir) and choose
the last file matching that glob that is not a symlink, the Libtool
'*.la' file or a Python file.

That works fine for ELF targets where the matching names are:

  libstdc++.a
  libstdc++.so
  libstdc++.so.6
  libstdc++.so.6.0.29

But not for macOS with:

  libstdc++.6.dylib
  libstdc++.a

Or MinGW with:

  libstdc++-6.dll
  libstdc++.dll.a

Try to make a better job at installing the pretty printers with the
correct name by copying the approach taken by isl [2], that is, using
a sed invocation on the Libtool-generated 'libstdc++.la' to read the
correct name for the current platform.

[1]
https://sourceware.org/gdb/onlinedocs/gdb/objfile_002dgdbdotext-file.html
[2] https://repo.or.cz/isl.git/blob/HEAD:/Makefile.am#l611

libstdc++-v3/ChangeLog:

PR libstdc++/99453
* python/Makefile.am: Install libstdc++*-gdb.py more robustly.
* python/Makefile.in: Regenerate.

Co-authored-by: Jonathan Wakely 
(cherry picked from commit c2fc1702cb3a3d5cc9c40de47f63b4c8f3f1d09c)

[Bug tree-optimization/100512] [12 Regression] ICE during GIMPLE pass: cddce in mark_operand_necessary, at tree-ssa-dce.c:173 (under -O2 to -Os) since r12-623-g1416a1434c43de0b

2021-05-11 Thread aldyh at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100512

--- Comment #4 from Aldy Hernandez  ---
After the mentioned commit, e_27(D) is considered undefined, and since
_3 is [0,0], e_26 folds to [0,0] and the PHI is marked for removal:

# e_26 = PHI 

However, when propagating to the uses of e_26 (replace_uses_in) here:

  if (e_26 != 0)

...value_of_expr() returns NULL, because get_non_stale_global_range()
considers the value of e_26 stale:

  if (m_globals.get_global_range (r, name))
{
  if (m_temporal->current_p (name))
return true;
}

The dependencies for e_26 are e_27 and _3, per the PHI, but _3 has a
later time stamp.

The full IL follows.  Notice the interdependence between e_26 and _3.

void b ()
{
  int16_t i;
  uint64_t * f;
  uint64_t e;
  uint16_t d;
  int16_t * c;
  long unsigned int _3;
  long int d.3_5;
  short int _7;
  int a.5_8;
  int iftmp.4_11;

   :
  d = 2;
  // predicted unlikely by goto predictor.
  goto ; [INV]

   :
  # e_25 = PHI 
  _3 = e_25 + 1;
  if (_3 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  goto ; [INV]

   :
  d.3_5 = (long int) 
  i_19 = (int16_t) d.3_5;
  if (i_19 != 0)
goto ; [INV]
  else
goto ; [INV]

   :
  if (e_26 != 0)
goto ; [INV]
  else
goto ; [INV]

   :

   :
  # iftmp.4_11 = PHI <1(6), 0(7)>
  _7 = (short int) iftmp.4_11;
  *c_22(D) = _7;
  goto ; [INV]

   :
  # e_26 = PHI 
g:

   :
  a.5_8 = a;
  if (a.5_8 != 0)
goto ; [INV]
  else
goto ; [INV]

}

[Bug debug/100541] New: [12 Regression] -fcompare-debug failure (length) with -O3 -fno-expensive-optimizations -fno-tree-dce -fno-tree-dominator-opts

2021-05-11 Thread zsojka at seznam dot cz via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100541

Bug ID: 100541
   Summary: [12 Regression] -fcompare-debug failure (length) with
-O3 -fno-expensive-optimizations -fno-tree-dce
-fno-tree-dominator-opts
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zsojka at seznam dot cz
  Target Milestone: ---
  Host: x86_64-pc-linux-gnu

Created attachment 50793
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50793=edit
auto-reduced testcase (from OpenTTD sources)

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O3 -fno-expensive-optimizations -fno-tree-dce
-fno-tree-dominator-opts -fcompare-debug testcase.C -save-temps
x86_64-pc-linux-gnu-gcc: error: testcase.C: '-fcompare-debug' failure (length)
$ diff -u *.gkd
--- a-testcase.C.gkd2021-05-11 21:38:59.070437639 +0200
+++ a-testcase.gk.C.gkd 2021-05-11 21:38:59.103770789 +0200
@@ -93,7 +93,7 @@
 (mult:SI (mem/c:SI (symbol_ref:DI ("y") [flags 0x2]  ) [ y+0 S4 A32])
 (const_int -1431655765 [0xaaab])))
 (clobber (reg:CC 17 flags))
-])# {*mulsi3_1}
+]) "testcase.C":8:5# {*mulsi3_1}
  (expr_list:REG_UNUSED (reg:CC 17 flags)
 (nil)))
 (insn:TI # 0 0 7 (parallel [
@@ -101,7 +101,7 @@
 (plus:SI (reg:SI 0 ax [113])
 (const_int 715827882 [0x2aaa])))
 (clobber (reg:CC 17 flags))
-])# {*addsi_1}
+]) "testcase.C":8:5# {*addsi_1}
  (expr_list:REG_UNUSED (reg:CC 17 flags)
 (nil)))
 (insn:TI # 0 0 7 (set (reg:CC 17 flags)
@@ -163,7 +163,7 @@
 (mult:SI (mem/c:SI (symbol_ref:DI ("y") [flags 0x2]  ) [ y+0 S4 A32])
 (const_int -1431655765 [0xaaab])))
 (clobber (reg:CC 17 flags))
-])# {*mulsi3_1}
+]) "testcase.C":17:1# {*mulsi3_1}
  (expr_list:REG_UNUSED (reg:CC 17 flags)
 (nil)))
 (insn:TI # 0 0 10 (parallel [
@@ -171,7 +171,7 @@
 (plus:SI (reg:SI 0 ax [100])
 (const_int 715827882 [0x2aaa])))
 (clobber (reg:CC 17 flags))
-])# {*addsi_1}
+]) "testcase.C":17:1# {*addsi_1}
  (expr_list:REG_UNUSED (reg:CC 17 flags)
 (nil)))
 (insn:TI # 0 0 10 (set (reg:CC 17 flags)

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

[Bug analyzer/100540] -Wanalyzer-file-leak false positive due to conditionals

2021-05-11 Thread dmalcolm at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100540

David Malcolm  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Last reconfirmed||2021-05-11

--- Comment #1 from David Malcolm  ---
Thanks for filing this bug.

Confirmed: the analyzer is considering the path where "fp == stdin", and thus
skipping the fclose (and then treating fp as still needing fclose).

[Bug analyzer/100540] New: -Wanalyzer-file-leak false positive due to conditionals

2021-05-11 Thread andrew at ishiboo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100540

Bug ID: 100540
   Summary: -Wanalyzer-file-leak false positive due to
conditionals
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: andrew at ishiboo dot com
  Target Milestone: ---

Test program:

#include 
#include 

char foo(const char *filename) {
FILE *fp;
if (!filename || strcmp(filename, "-") == 0) {
fp = stdin;
} else {
fp = fopen(filename, "r");
}

char c = fgetc(fp);

if (fp != stdin) {
fclose(fp);
}

return c;
}

int main(int argc, char **argv) {
if (argc > 1) {
char c = foo(argv[1]);
printf("%c\n", c);
}
return 0;
}

False positive:

$ gcc-11 -fanalyzer -c /tmp/test.c  
/tmp/test.c: In function 'foo':
/tmp/test.c:18:12: warning: leak of FILE 'fp' [CWE-775] [-Wanalyzer-file-leak]
   18 | return c;
  |^
  'foo': events 1-6
|
|6 | if (!filename || strcmp(filename, "-") == 0) {
|  |^
|  ||
|  |(1) following 'false' branch...
|..
|9 | fp = fopen(filename, "r");
|  |  
|  |  |
|  |  (2) ...to here
|  |  (3) opened here
|..
|   14 | if (fp != stdin) {
|  |~
|  ||
|  |(4) following 'false' branch...
|..
|   18 | return c;
|  |~
|  ||
|  |(5) ...to here
|  |(6) 'fp' leaks here; was opened at (3)
|


Expected outcome:

The analyzer should understand that without anything modifying stdin, stdout,
stderr, the return of fopen() can not be stdin, stdout, or stderr, so
fclose(fp) must be hit.

[Bug middle-end/100537] Bootstrap-O3 and bootstrap-debug fail on 32-bit ARM after gcc-12-657-ga076632e274a

2021-05-11 Thread mkuvyrkov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100537

--- Comment #2 from Maxim Kuvyrkov  ---
So far I managed to reproduce this only with armhf Go build, so one needs go1
binary from either a native armhf system or an armhf cross-toolchain to
reproduce.

To reproduce on a native system configure GCC with:
../gcc/configure --disable-bootstrap --disable-multilib --with-float=hard
--enable-languages=go

To reproduce using a cross-toolchain and Linaro scripts:
git clone https://git.linaro.org/toolchain/abe.git
cd abe
./configure
./abe.sh --target arm-linux-gnueabihf --build all --extraconfigdir
config/master

[Bug target/100445] [12 Regression] ice during RTL pass: vregs

2021-05-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100445

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #15 from Jakub Jelinek  ---
.

[Bug target/100445] [12 Regression] ice during RTL pass: vregs

2021-05-11 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100445

--- Comment #14 from David Binderman  ---
AFAIK, yes. I didn't try out the gcc/testsuite, but I did try out
all the places (about 20) where fedora rawhide failed to build.

[Bug c++/100502] [11/12 Regression] ICE in enforce_access at cp/semantics.c:368 since r11-6800-g29853c653245c37e

2021-05-11 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100502

--- Comment #2 from Patrick Palka  ---
Extended testcase that also instantiates the friend function:

template 
struct EnumeratorRange {
  struct Iterator {
EnumeratorRange range_;

friend bool f(Iterator i) { return i.range_.end_reached_; }
  };

 private:
  bool end_reached_;
};

int main() {
  EnumeratorRange::Iterator i;
  f(i);
}

Before r11-6800, GCC rejected this testcase, however Clang accepts it.  ISTM we
were correct to reject because although members of a nested class have full
access to the enclosing class, a hidden friend function defined inside the
nested class isn't really a class member, so [class.access.nest] doesn't apply.

[Bug c++/100502] [11/12 Regression] ICE in enforce_access at cp/semantics.c:368 since r11-6800-g29853c653245c37e

2021-05-11 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100502

Patrick Palka  changed:

   What|Removed |Added

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

[Bug debug/100515] [12 Regression] ICE in output_rnglists, at dwarf2out.c:12294 since r12-574-ge69ac0203725fb8d

2021-05-11 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100515

--- Comment #3 from Martin Liška  ---
I noticed the same problem with Ada bootstrap:

[  128s] +===GNAT BUG
DETECTED==+
[  128s] | 12.0.0 20210511 (experimental) [revision
6ab1176667734bd6de20833f8d263c03a418c452] (x86_64-suse-linux) GCC error:|
[  128s] | in output_rnglists, at dwarf2out.c:12294
|
[  128s] | Error detected around
/usr/lib64/gcc/x86_64-suse-linux/12/adainclude/s-atacco.ads:39:16|
[  128s] | Please submit a bug report; see https://gcc.gnu.org/bugs/ . 
|
[  128s] | Use a subject line meaningful to you and us to track the bug.   
|
[  128s] | Include the entire contents of this bug box in the report.  
|
[  128s] | Include the exact command that you entered. 
|
[  128s] | Also include sources listed below.  
|

[Bug tree-optimization/100539] New: wrong code at -Os and above with "-fno-dce -fno-inline-small-functions -fno-tree-dce"

2021-05-11 Thread zhendong.su at inf dot ethz.ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100539

Bug ID: 100539
   Summary: wrong code at -Os and above with "-fno-dce
-fno-inline-small-functions -fno-tree-dce"
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

[514] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
15e6b45c9ad:45dc47d4720:cf43636a74a028daf2024b33d1915274a2ff9655] (GCC) 
[515] % 
[515] % gcctk -Os small.c; ./a.out
[516] % 
[516] % gcctk -Os -fno-dce -fno-inline-small-functions -fno-tree-dce small.c
[517] % ./a.out
Segmentation fault
[518] % 
[518] % cat small.c
int a, b;
static void c(int *d) {
  int e = 0;
  for (; a < 1; a++)
e |= (b == *d);
}
int main() {
  int g = 0;
  c();
  return 0;
}

[Bug c++/100538] New: g++ miscompile / ICE with variadic member function pointer argument list

2021-05-11 Thread profclonk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100538

Bug ID: 100538
   Summary: g++ miscompile / ICE with variadic member function
pointer argument list
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: profclonk at gmail dot com
  Target Milestone: ---

Created attachment 50792
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50792=edit
Source code triggering the GCC bug

Dear GCC team,

the attached code passes member function pointers to a template function. The
code should print "bar" once, but doesn't (miscompile). When commenting out
line 19 and enabling line 22 I get an internal compiler error:

: In instantiation of 'void foo(MemPtrList) [with
SubPtrTypes = int; SubPtrTypes X::* ...SubRefs = {::a}]':
:26:6:   required from here
:22:9: internal compiler error: in finish_expr_stmt, at
cp/semantics.c:860
   22 | (bar (), ...);
  | ^
0x1780bf9 internal_error(char const*, ...)
???:0
0x677e40 fancy_abort(char const*, int, char const*)
???:0
0x80362c finish_expr_stmt(tree_node*)
???:0
0x7dcec3 instantiate_decl(tree_node*, bool, bool)
???:0
0x7f7aab instantiate_pending_templates(int)
???:0
0x708f4d c_parse_final_cleanups()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
ASM generation compiler returned: 1

The error happens on x86-64 Windows 10 when using MinGW-w64 via MSYS2, and also
on Compiler Explorer ( https://godbolt.org/z/vhPqKaqeW ,
https://godbolt.org/z/feP5GPdP4 ). It works fine in Clang.

Thanks,
Niklas

[Bug middle-end/100537] Bootstrap-O3 and bootstrap-debug fail on 32-bit ARM after gcc-12-657-ga076632e274a

2021-05-11 Thread mkuvyrkov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100537

Maxim Kuvyrkov  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org
 Target||arm-linux-gnueabihf

--- Comment #1 from Maxim Kuvyrkov  ---
A reduced testcase is coming ...

[Bug middle-end/100537] New: Bootstrap-O3 and bootstrap-debug fail on 32-bit ARM after gcc-12-657-ga076632e274a

2021-05-11 Thread mkuvyrkov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100537

Bug ID: 100537
   Summary: Bootstrap-O3 and bootstrap-debug fail on 32-bit ARM
after gcc-12-657-ga076632e274a
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: mkuvyrkov at gcc dot gnu.org
  Target Milestone: ---

Patch a076632e274abe344ca7648b7c7f299273d4cbe0 appears to have broken
bootstrap-O3 and bootstrap-debug at least on 32-bit armhf.

00:33:32 In function ‘syscall.forkExec’:
00:33:32 go1: error: address taken, but ADDRESSABLE bit not set
00:33:32 PHI argument
00:33:32 
00:33:32 for PHI node
00:33:32 err$__object_78 = PHI 
00:33:32 during GIMPLE pass: fre
00:33:32 go1: internal compiler error: verify_ssa failed
00:33:32 0x9c18d7 verify_ssa(bool, bool)
00:33:32   
/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/snapshots/gcc.git~master/gcc/tree-ssa.c:1214
00:33:32 0x6f8d5b execute_function_todo
00:33:32   
/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/snapshots/gcc.git~master/gcc/passes.c:2049
00:33:32 0x6f9abf do_per_function
00:33:32   
/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/snapshots/gcc.git~master/gcc/passes.c:1687
00:33:32 0x6f9abf execute_todo
00:33:32   
/home/tcwg-buildslave/workspace/tcwg_gnu_0/abe/snapshots/gcc.git~master/gcc/passes.c:2096
00:33:32 Please submit a full bug report,
00:33:32 with preprocessed source if appropriate.
00:33:32 Please include the complete backtrace with any bug report.
00:33:32 See  for instructions.
00:33:32 Makefile:3001: recipe for target 'syscall.lo' failed

[Bug libstdc++/100249] missing forwarding std::__invoke result in ranges::is_permutation and ranges::clamp

2021-05-11 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100249

--- Comment #9 from Patrick Palka  ---
(In reply to 康桓瑋 from comment #8)
> (In reply to Patrick Palka from comment #6)
> > > Maybe this can help:
> > > 
> > >   auto&& __proj_val = std::__invoke(__proj, __val);
> > >   if (std::__invoke(__comp,
> > > std::forward(__proj_val), std::__invoke(__proj, 
> > > __lo)))
> > > return __lo;
> > 
> > We could safely forward __proj_val only in the second invocation of __comp,
> > after which __proj_val is no longer used, but I'm not sure that's
> > worthwhile...
> 
> I specifically asked the forum for this, Tim Song replied that both forwards
> are safe, you can see more details in
> https://stackoverflow.com/a/67348274/11638718.
> Sorry to reply so late.

Thanks for looking into this!

[Bug libstdc++/100475] semiregular-box's constructor uses wrong list-initialization

2021-05-11 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100475

--- Comment #5 from Patrick Palka  ---
(In reply to 康桓瑋 from comment #4)
> (In reply to 康桓瑋 from comment #3)
> > Also, the operator->() simply uses operator& instead of std::__addressof.
> > 
> > https://godbolt.org/z/zfGnEoePG

Good catch, thanks.

> 
> Another issue is that the has_value() of this specialization will always
> return true, which will make the precondition
> __glibcxx_assert(_M_pred.has_value()) for filter_view's begin() almost
> useless.

That's fine I suppose, the assert will just be a no-op in that case.

> 
> Although it is not clear why semiregular-box is partial specialization in
> gcc-11, it is obvious that this needs to be treated with care.

The advantage of the partial specialization is that it's space-optimal whereas
the primary template is not, due to its use of std::optional.

[Bug libstdc++/78052] [5/6/7 Regression] allocator_traits> partial specialization vs allocator

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78052

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

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

commit r12-723-g5e3a1ea3d89d62972e1f036b2ede37a80b880bdf
Author: Jonathan Wakely 
Date:   Tue May 11 15:01:01 2021 +0100

libstdc++: Fix missing members in std::allocator

The changes in 75c6a925dab5b7af9ab47c10906cb0e140261cc2 were slightly
incorrect, because the converting constructor should be noexcept, and
the POCMA and is_always_equal traits should still be present in C++20.
This fixes it, and slightly refactors the preprocessor conditions and
order of members. Also add comments explaining things.

The non-standard construct and destroy members added for PR 78052 can be
private if allocator_traits> is made a friend.

libstdc++-v3/ChangeLog:

* include/bits/allocator.h (allocator) [C++20]: Add
missing noexcept to constructor. Restore missing POCMA and
is_always_equal_traits.
[C++17]: Make construct and destroy members private and
declare allocator_traits as a friend.
* include/bits/memoryfwd.h (allocator_traits): Declare.
* include/ext/malloc_allocator.h (malloc_allocator::allocate):
Add nodiscard attribute. Add static assertion for LWG 3307.
* include/ext/new_allocator.h (new_allocator::allocate): Add
static assertion for LWG 3307.
* testsuite/20_util/allocator/void.cc: Check that converting
constructor is noexcept. Check for propagation traits and
size_type and difference_type. Check that pointer and
const_pointer are gone in C++20.

[Bug c/100536] New: ICE: in expand_call, at calls.c:4980

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100536

Bug ID: 100536
   Summary: ICE: in expand_call, at calls.c:4980
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
struct {
  union {
union {
  union {
union {
  union {
union {
  double b[4];
} a[18];
  } a[18];
} a[18];
  } a[18];
} a[18];
  } a[18];
} s;
baz() { bar(s); }

$ gcc-trunk  mutant.c
mutant.c:16:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   16 | baz() { bar(s); }
  | ^~~
mutant.c: In function ‘baz’:
mutant.c:16:9: warning: implicit declaration of function ‘bar’; did you mean
‘baz’? [-Wimplicit-function-declaration]
   16 | baz() { bar(s); }
  | ^~~
  | baz
mutant.c:16:9: sorry, unimplemented: passing too large argument on stack
   16 | baz() { bar(s); }
  | ^~
during RTL pass: expand
mutant.c:16:9: internal compiler error: in expand_call, at calls.c:4980
0x686a4e expand_call(tree_node*, rtx_def*, int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/calls.c:4980
0xb5fe9e expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/expr.c:11461
0xa3cfc9 expand_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/expr.h:301
0xa3cfc9 expand_call_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:2843
0xa3cfc9 expand_gimple_stmt_1
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:3847
0xa3cfc9 expand_gimple_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:4011
0xa428c9 expand_gimple_basic_block
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:6048
0xa4451f execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cfgexpand.c:6732
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100535] New: ICE: tree check: expected function_type or method_type, have integer_type in gimplify_call_expr, at gimplify.c:3457

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100535

Bug ID: 100535
   Summary: ICE: tree check: expected function_type or
method_type, have integer_type in gimplify_call_expr,
at gimplify.c:3457
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__GIMPLE
foo() {
  int t1;
  t1_1 = __builtin_abs(__builtin_abs());
}

$ gcc-trunk  mutant.c
mutant.c:1:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
1 | __GIMPLE
  | ^~~~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo() {
  | ^~~
during GIMPLE pass: lower
mutant.c: In function ‘foo’:
mutant.c:4:24: internal compiler error: tree check: expected function_type or
method_type, have integer_type in gimplify_call_expr, at gimplify.c:3457
4 |   t1_1 = __builtin_abs(__builtin_abs());
  |^
0x7bca06 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8674
0x6e13ef tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3375
0x6e13ef gimplify_call_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:3457
0xc25d73 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14055
0xc27bf9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14829
0xc493c1 force_gimple_operand_1(tree_node*, gimple**, bool (*)(tree_node*),
tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify-me.c:78
0xbf1980 gimplify_and_update_call_from_tree(gimple_stmt_iterator*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-fold.c:790
0xbff139 gimple_fold_builtin
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-fold.c:5165
0xc012b0 gimple_fold_call
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-fold.c:5581
0xc0288b fold_stmt_1
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-fold.c:6283
0x19177c3 lower_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:388
0x19177c3 lower_sequence
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:217
0x191766d lower_gimple_bind
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:473
0x191852d lower_function_body
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:110
0x191852d execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:195
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100534] New: ICE: internal compiler error: tree check: expected string_cst, have call_expr in get_attr_len, at multiple_target.c:198

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100534

Bug ID: 100534
   Summary: ICE: internal compiler error: tree check: expected
string_cst, have call_expr in get_attr_len, at
multiple_target.c:198
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__attribute__((target_clones(foo( baz() {}

$ gcc-trunk  mutant.c
mutant.c:1:30: warning: implicit declaration of function ‘foo’
[-Wimplicit-function-declaration]
1 | __attribute__((target_clones(foo( baz() {}
  |  ^~~
mutant.c:1:39: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | __attribute__((target_clones(foo( baz() {}
  |   ^~~
during IPA pass: targetclone
mutant.c:1:1: internal compiler error: tree check: expected string_cst, have
call_expr in get_attr_len, at multiple_target.c:198
1 | __attribute__((target_clones(foo( baz() {}
  | ^
0x7bca06 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8674
0x89f978 tree_check(tree_node*, char const*, int, char const*, tree_code)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3356
0x89f978 get_attr_len
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:198
0x89f978 expand_target_clones
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:344
0x89f978 ipa_target_clone
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:517
0x89f978 execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:553
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c++/100516] [11 Regression] Unexpected -Wstringop-overread in deque initialization from empty initializer_list

2021-05-11 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100516

Martin Sebor  changed:

   What|Removed |Added

 Blocks||97048
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2021-05-11
  Known to work||10.3.0
Summary|Unexpected  |[11 Regression] Unexpected
   |-Wstringop-overread in  |-Wstringop-overread in
   |deque initialization  |deque initialization
   |from empty initializer_list |from empty initializer_list
  Known to fail||11.1.0, 12.0

--- Comment #3 from Martin Sebor  ---
Confirmed.  Strictly speaking it's a GCC 11 regression introduced by a) the
warning becoming stricter and considering constant addresses to be invalid (as
they usually result from invalid arithmetic involving null pointers), and b)
GCC 11 exposing the null pointer arithmetic.  The warning in the original test
case in comment #0 triggers for the IL below where _19 is set to the address
512 plus some offset:

   [local count: 955247968]:
  _18 = (unsigned long) _58;
  _67 = (unsigned long) __cur_node_17;
  _13 = _18 + 18446744073709551615;
  _40 = _13 - _67;
  _25 = _40 >> 3;
  _3 = _25 * 512;
  _19 = 512B + _3;  <<< 512 (invalid address)
  _26 = D.17216.D.17192._M_impl.D.16554._M_finish._M_first;
  _39 = (long int) _19;
  _Num_28 = -_39;
  _Num.7_29 = (long unsigned int) _Num_28;  <<< nonzero
  __builtin_memcpy (_26, _19, _Num.7_29);   <<< -Wstringop-overread

Since there can be no object at address 512 its size is determined to be zero. 
The warning triggers because the third argument to memcpy is determined to be
nonzero (also 512 plus some offset).  The bad address results from SCCP:

final value replacement:
  _19 = PHI <_37(4)>
 with expr: 512B + unsigned long) _58 - (unsigned long) __cur_node_17) +
18446744073709551615) / 8) * 512
 final stmt:
  _19 = 512B + _3;

based on:

   [local count: 8684072504]:
  # __first_2 = PHI <_37(10), 0B(9)>
  # __cur_node_42 = PHI <__cur_node_24(10), __cur_node_17(9)>
  _37 = __first_2 + 512;

The underlying problem is that the loop in deque::_M_range_initialize()
iterates over both the deque's nodes and the initializer list's elements, and
the number of iterations has no apparent relationship to the latter.  As far as
GCC sees, the loop increments the null pointer to the empty initializer list by
the deque's buffer size of 512.  The warning could be avoided by
_M_range_initialize() returning early, before entering the loop, when the range
is empty.  Alternatively, it could be suppressed by #pragma GCC diagnostic
(that might need a patch like the one mentioned in pr98465 comment 32).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97048
[Bug 97048] [meta-bug] bogus/missing -Wstringop-overread warnings

[Bug c/100532] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:259

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100532

--- Comment #1 from Chengnian Sun  ---
Another duplicate.


$ cat mutant.c
void *memcpy(void[], const void *, __SIZE_TYPE__);
f(x) {
  if (f)
memcpy(x, x, x);
}

$ gcc-trunk  mutant.c
mutant.c:1:18: error: declaration of type name as array of voids
1 | void *memcpy(void[], const void *, __SIZE_TYPE__);
  |  ^
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | f(x) {
  | ^
mutant.c: In function ‘f’:
mutant.c:2:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
mutant.c:4:12: error: type of formal parameter 1 is incomplete
4 | memcpy(x, x, x);
  |^
mutant.c:4:15: warning: passing argument 2 of ‘memcpy’ makes pointer from
integer without a cast [-Wint-conversion]
4 | memcpy(x, x, x);
  |   ^
  |   |
  |   int
mutant.c:1:22: note: expected ‘const void *’ but argument is of type ‘int’
1 | void *memcpy(void[], const void *, __SIZE_TYPE__);
  |  ^~~~
mutant.c:4:5: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:259
4 | memcpy(x, x, x);
  | ^~
0x7bce07 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8724
0x6cb4a3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3479
0x6cb4a3 useless_type_conversion_p(tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:259
0xc2fc77 types_compatible_p
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.h:67
0xc2fc77 gimplify_addr_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6246
0xc25d93 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14130
0xc34d59 gimplify_call_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:3446
0xc25d73 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14055
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2d4cb gimplify_cond_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:4264
0xc25a77 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14040
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2979e gimplify_bind_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:1421
0xc259d3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14284
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2a563 gimplify_body(tree_node*, bool)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15328
0xc2a9b1 gimplify_function_tree(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15482
0xa7e707 cgraph_node::analyze()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:670
0xa81611 analyze_functions
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xa820e1 symbol_table::finalize_compilation_unit()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2508
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug rtl-optimization/100533] New: [10/11/12 Regression] aarch64: -fcompare-debug failure with -O -fmodulo-sched

2021-05-11 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100533

Bug ID: 100533
   Summary: [10/11/12 Regression] aarch64: -fcompare-debug failure
with -O -fmodulo-sched
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat test.cc
short arr_747[7][15];
void init() {
  for (long i_0 = 0; i_0 < 2; ++i_0)
for (long i_1 = 0; i_1 < 14; ++i_1)
  arr_747[i_0][i_1] = 1;
}
$ aarch64-linux-gnu-gcc -c test.cc -fcompare-debug -O -fmodulo-sched
aarch64-linux-gnu-gcc: error: test.cc: ‘-fcompare-debug’ failure

Maybe related to PR100523 in that both require -fmodulo-sched (although it's
not clear at this stage).

[Bug c/100532] New: ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:259

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100532

Bug ID: 100532
   Summary: ICE: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.c:259
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

Might be a duplicate of PR 100525.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
typedef __SIZE_TYPE__ size_t;
void *memcpy(void[], const void *, size_t);
c() { memcpy(c, "a", 2); }

$ gcc-trunk  mutant.c
mutant.c:2:18: error: declaration of type name as array of voids
2 | void *memcpy(void[], const void *, size_t);
  |  ^
mutant.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
3 | c() { memcpy(c, "a", 2); }
  | ^
mutant.c: In function ‘c’:
mutant.c:3:14: error: type of formal parameter 1 is incomplete
3 | c() { memcpy(c, "a", 2); }
  |  ^
mutant.c:3:7: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:259
3 | c() { memcpy(c, "a", 2); }
  |   ^~
0x7bce07 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8724
0x6cb4a3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3479
0x6cb4a3 useless_type_conversion_p(tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:259
0xc2fc77 types_compatible_p
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.h:67
0xc2fc77 gimplify_addr_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6246
0xc25d93 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14130
0xc34d59 gimplify_call_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:3446
0xc25d73 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14055
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2979e gimplify_bind_expr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:1421
0xc259d3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:14284
0xc28f6a gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:6877
0xc2a563 gimplify_body(tree_node*, bool)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15328
0xc2a9b1 gimplify_function_tree(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15482
0xa7e707 cgraph_node::analyze()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:670
0xa81611 analyze_functions
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xa820e1 symbol_table::finalize_compilation_unit()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2508
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100531] New: ICE: tree check: expected string_cst, have ne_expr in get_attr_len, at multiple_target.c:198

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100531

Bug ID: 100531
   Summary: ICE: tree check: expected string_cst, have ne_expr in
get_attr_len, at multiple_target.c:198
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__attribute__((target_clones(foo() != 3))) foo() {}

$ gcc-trunk  mutant.c
mutant.c:1:30: warning: implicit declaration of function ‘foo’
[-Wimplicit-function-declaration]
1 | __attribute__((target_clones(foo() != 3))) foo() {}
  |  ^~~
mutant.c:1:44: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | __attribute__((target_clones(foo() != 3))) foo() {}
  |^~~
during IPA pass: targetclone
mutant.c:1:1: internal compiler error: tree check: expected string_cst, have
ne_expr in get_attr_len, at multiple_target.c:198
1 | __attribute__((target_clones(foo() != 3))) foo() {}
  | ^
0x7bca06 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8674
0x89f978 tree_check(tree_node*, char const*, int, char const*, tree_code)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3356
0x89f978 get_attr_len
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:198
0x89f978 expand_target_clones
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:344
0x89f978 ipa_target_clone
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:517
0x89f978 execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:553
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100530] New: ICE with -g: in add_dwarf_attr, at dwarf2out.c:4493

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100530

Bug ID: 100530
   Summary: ICE with -g: in add_dwarf_attr, at dwarf2out.c:4493
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__seg_gs i;

$ gcc-trunk -g mutant.c
mutant.c:1:10: warning: type defaults to ‘int’ in declaration of ‘i’
[-Wimplicit-int]
1 | __seg_gs i;
  |  ^
mutant.c:1:1: internal compiler error: in add_dwarf_attr, at dwarf2out.c:4493
1 | __seg_gs i;
  | ^~~~
0x6a0017 add_dwarf_attr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:4493
0x6a0017 add_dwarf_attr
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:4480
0x6a0017 add_AT_string
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:4753
0x6a0017 add_name_attribute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:20909
0xb0587c add_name_attribute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:13684
0xb0587c modified_type_die
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:13876
0xb078f4 add_type_attribute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:22023
0xafb587 gen_variable_die
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:24331
0xb1d6c8 gen_decl_die
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:26780
0xb1ec96 dwarf2out_decl
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:27270
0xb1f434 dwarf2out_early_global_decl
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/dwarf2out.c:26920
0x8dfeeb finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-decl.c:5534
0x9431ab c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2370
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100529] ICE at -O3: in force_constant_size, at gimplify.c:733

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100529

--- Comment #1 from Chengnian Sun  ---
A possible duplicate.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
bar(n) { return foo(n, 2.0); }
foo(
int n, struct { char a[n]; }) {
  return foo;
}

$ gcc-trunk -O3 mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | bar(n) { return foo(n, 2.0); }
  | ^~~
mutant.c: In function ‘bar’:
mutant.c:1:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
mutant.c:1:17: warning: implicit declaration of function ‘foo’
[-Wimplicit-function-declaration]
1 | bar(n) { return foo(n, 2.0); }
  | ^~~
mutant.c: At top level:
mutant.c:3:12: warning: anonymous struct declared inside parameter list will
not be visible outside of this definition or declaration
3 | int n, struct { char a[n]; }) {
  |^~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo(
  | ^~~
mutant.c: In function ‘foo’:
mutant.c:4:10: warning: returning ‘int (*)(int,  struct )’ from a
function with return type ‘int’ makes integer from pointer without a cast
[-Wint-conversion]
4 |   return foo;
  |  ^~~
In function ‘foo.constprop’:
cc1: internal compiler error: in force_constant_size, at gimplify.c:733
0x6d5542 force_constant_size
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:733
0xc21537 gimple_add_tmp_var(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:771
0xbea82b create_tmp_var(tree_node*, char const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:485
0xc2b230 create_tmp_from_val
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:564
0xc2b230 lookup_tmp_var
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:596
0xc2b230 internal_get_tmp_var
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:635
0xc24bb7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15072
0xc49b43 gimple_regimplify_operands(gimple*, gimple_stmt_iterator*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify-me.c:235
0xf7689a insert_init_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree-inline.c:3377
0xf88e47 tree_function_versioning(tree_node*, tree_node*, vec*, ipa_param_adjustments*, bool, bitmap_head*,
basic_block_def*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree-inline.c:6418
0xa83c85 cgraph_node::materialize_clone()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphclones.c:1131
0xe0b8f8 execute_all_ipa_transforms(bool)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/passes.c:2329
0xa7de49 cgraph_node::expand()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1821
0xa7f26f expand_all_functions
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1992
0xa7f26f symbol_table::compile()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2356
0xa8214b symbol_table::compile()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2269
0xa8214b symbol_table::finalize_compilation_unit()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2537
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100529] New: ICE at -O3: in force_constant_size, at gimplify.c:733

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100529

Bug ID: 100529
   Summary: ICE at -O3: in force_constant_size, at gimplify.c:733
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
bar(n) { return foo(n, 2.0); }
foo(
int n, struct { char a[n]; }) {}

$ gcc-trunk -O3 mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | bar(n) { return foo(n, 2.0); }
  | ^~~
mutant.c: In function ‘bar’:
mutant.c:1:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
mutant.c:1:17: warning: implicit declaration of function ‘foo’
[-Wimplicit-function-declaration]
1 | bar(n) { return foo(n, 2.0); }
  | ^~~
mutant.c: At top level:
mutant.c:3:12: warning: anonymous struct declared inside parameter list will
not be visible outside of this definition or declaration
3 | int n, struct { char a[n]; }) {}
  |^~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo(
  | ^~~
In function ‘foo.constprop’:
cc1: internal compiler error: in force_constant_size, at gimplify.c:733
0x6d5542 force_constant_size
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:733
0xc21537 gimple_add_tmp_var(tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:771
0xbea82b create_tmp_var(tree_node*, char const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:485
0xc2b230 create_tmp_from_val
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:564
0xc2b230 lookup_tmp_var
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:596
0xc2b230 internal_get_tmp_var
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:635
0xc24bb7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify.c:15072
0xc49b43 gimple_regimplify_operands(gimple*, gimple_stmt_iterator*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimplify-me.c:235
0xf7689a insert_init_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree-inline.c:3377
0xf88e47 tree_function_versioning(tree_node*, tree_node*, vec*, ipa_param_adjustments*, bool, bitmap_head*,
basic_block_def*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree-inline.c:6418
0xa83c85 cgraph_node::materialize_clone()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphclones.c:1131
0xa70dbd cgraph_node::get_untransformed_body()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraph.c:3921
0xa7dda9 cgraph_node::expand()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1799
0xa7f26f expand_all_functions
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:1992
0xa7f26f symbol_table::compile()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2356
0xa8214b symbol_table::compile()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2269
0xa8214b symbol_table::finalize_compilation_unit()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/cgraphunit.c:2537
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100528] New: ICE: tree check: expected string_cst, have plus_expr in get_attr_len, at multiple_target.c:198

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100528

Bug ID: 100528
   Summary: ICE: tree check: expected string_cst, have plus_expr
in get_attr_len, at multiple_target.c:198
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
a;
__attribute__((target_clones(a + 0x12345U))) fast_clamp() {}

$ gcc-trunk -O0 mutant.c
mutant.c:1:1: warning: data definition has no type or storage class
1 | a;
  | ^
mutant.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’
[-Wimplicit-int]
mutant.c:2:46: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | __attribute__((target_clones(a + 0x12345U))) fast_clamp() {}
  |  ^~
during IPA pass: targetclone
mutant.c:2:1: internal compiler error: tree check: expected string_cst, have
plus_expr in get_attr_len, at multiple_target.c:198
2 | __attribute__((target_clones(a + 0x12345U))) fast_clamp() {}
  | ^
0x7bca06 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8674
0x89f978 tree_check(tree_node*, char const*, int, char const*, tree_code)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3356
0x89f978 get_attr_len
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:198
0x89f978 expand_target_clones
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:344
0x89f978 ipa_target_clone
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:517
0x89f978 execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/multiple_target.c:553
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100527] New: ICE: Segmentation fault, flags_from_decl_or_type(tree_node const*)

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100527

Bug ID: 100527
   Summary: ICE: Segmentation fault,
flags_from_decl_or_type(tree_node const*)
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__GIMPLE
foo() {
  int __builtin_abs;
  __builtin_abs();
}

$ gcc-trunk -O0 mutant.c
mutant.c:1:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
1 | __GIMPLE
  | ^~~~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo() {
  | ^~~
mutant.c: In function ‘foo’:
mutant.c:4:3: internal compiler error: Segmentation fault
4 |   __builtin_abs();
  |   ^
0xef7273 crash_signal
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/toplev.c:327
0xa1e00e flags_from_decl_or_type(tree_node const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/calls.c:810
0xbe2c32 gimple_call_flags(gimple const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple.c:1474
0xbe2d9c gimple_call_reset_alias_info(gcall*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple.c:210
0xbe2ef6 gimple_build_call_1
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple.c:235
0xbe2ef6 gimple_build_call_from_tree(tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple.c:375
0x953929 c_parser_gimple_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:719
0x953929 c_parser_gimple_compound_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:650
0x953929 c_parser_gimple_compound_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:381
0x954fa7 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:253
0x944187 c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2533
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug libstdc++/100479] range adaptors handle cached iterators incorrectly

2021-05-11 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100479

Patrick Palka  changed:

   What|Removed |Added

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

[Bug c/100526] New: ICE: segmentation fault in gimple-parser.c2049

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100526

Bug ID: 100526
   Summary: ICE: segmentation fault in gimple-parser.c2049
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__GIMPLE
foo() { enum tst; }

$ gcc-trunk -O0 mutant.c
mutant.c:1:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
1 | __GIMPLE
  | ^~~~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo() { enum tst; }
  | ^~~
mutant.c: In function ‘foo’:
mutant.c:2:17: error: expected identifier or ‘(’ before ‘;’ token
2 | foo() { enum tst; }
  | ^
mutant.c:2:17: internal compiler error: Segmentation fault
0xef7273 crash_signal
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/toplev.c:327
0x9528a8 c_parser_gimple_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:2049
0x9528a8 c_parser_gimple_compound_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:391
0x954fa7 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:253
0x944187 c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2533
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100525] New: ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100525

Bug ID: 100525
   Summary: ICE: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in
useless_type_conversion_p, at gimple-expr.c:87
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__GIMPLE
foo() { __builtin_abs(a); }

$ gcc-trunk -O0 mutant.c
mutant.c:1:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
1 | __GIMPLE
  | ^~~~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo() { __builtin_abs(a); }
  | ^~~
mutant.c: In function ‘foo’:
mutant.c:2:23: error: ‘a’ undeclared (first use in this function)
2 | foo() { __builtin_abs(a); }
  |   ^
mutant.c:2:23: note: each undeclared identifier is reported only once for each
function it appears in
during GIMPLE pass: lower
mutant.c:2:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87
2 | foo() { __builtin_abs(a); }
  | ^~~
0x7bce07 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.c:8724
0x6cb6de tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree.h:3479
0x6cb6de useless_type_conversion_p(tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:87
0xbe57da gimple_builtin_call_types_compatible_p(gimple const*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple.c:2723
0x19177b5 lower_stmt
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:387
0x19177b5 lower_sequence
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:217
0x191766d lower_gimple_bind
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:473
0x191852d lower_function_body
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:110
0x191852d execute
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-low.c:195
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug target/99988] aarch64: GCC generates excessive consecutive bti j instructions

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99988

--- Comment #6 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Alex Coplan
:

https://gcc.gnu.org/g:1011bb8bc67cf34c45a9237d72a801a14ad9ef0f

commit r11-8379-g1011bb8bc67cf34c45a9237d72a801a14ad9ef0f
Author: Alex Coplan 
Date:   Wed Apr 21 14:42:04 2021 +0100

aarch64: Avoid duplicating bti j insns for jump tables [PR99988]

This patch fixes PR99988 which shows us generating large (> 250)
sequences of back-to-back bti j instructions.

The fix is simply to avoid inserting bti j instructions at the target of
a jump table if we've already inserted one for a given label.

Co-Authored-By: Christophe Lyon 

gcc/ChangeLog:

PR target/99988
* config/aarch64/aarch64-bti-insert.c (aarch64_bti_j_insn_p): New.
(rest_of_insert_bti): Avoid inserting duplicate bti j insns for
jump table targets.

gcc/testsuite/ChangeLog:

PR target/99988
* gcc.target/aarch64/pr99988.c: New test.

[Bug analyzer/100524] New: pragma GCC diagnostic ignored "-Wanalyzer-too-complex" ignored by cc1

2021-05-11 Thread andrew at ishiboo dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100524

Bug ID: 100524
   Summary: pragma GCC diagnostic ignored "-Wanalyzer-too-complex"
ignored by cc1
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: andrew at ishiboo dot com
  Target Milestone: ---

Invoking the compiler from the command line as:
  gcc -fanalyzer -Wanalyzer-too-complex -Werror=analyzer-too-complex ...

Source code contains a function that generates a -Wanalyzer-too-complex error
(exact error unimportant):
  ...
  cc1: error: terminating analysis for this program point: callstring: [(SN: 17
-> SN: 9 in X), (SN: 141 -> SN: 16 in X)] before (SN: 115 stmt: 0):  # DEBUG
emptySlots$1 => emptySlots$1_80EN: 973-975, EN: 1017-1018, EN: 1054-1056
[-Werror=analyzer-too-complex]
  test.c: At top level:
  test.c:516:22: error analysis bailed out early (916 'after-snode' enodes;
3258 enodes) [-Werror=analyzer-too-complex]
516 | ...
|
  cc1: all warnings being treated as errors

Placing pragma diagnostic guards around the function in question silences the
compiler front-end error, but cc1 still produces the same errors and fails with
-Werror=analyzer-too-complex:

  #pragma diagnostic GCC push
  #pragma diagnostic GCC ignored "-Wanalyzer-too-complex"
  // function definition that generates the error
  #pragma diagnostic GCC pop

Output:
  ...
  cc1: error: terminating analysis for this program point: callstring: [(SN: 17
-> SN: 9 in X), (SN: 141 -> SN: 16 in X)] before (SN: 115 stmt: 0):  # DEBUG
emptySlots$1 => emptySlots$1_80EN: 973-975, EN: 1017-1018, EN: 1054-1056
[-Werror=analyzer-too-complex]
  cc1: all warnings being treated as errors

The "test.c" output with the compiler error and source code context are no
longer output, but cc1 still produces a fatal error and halts compilation.

I would expect that if the warning is `#pragma diagnostic GCC ignored` that cc1
would respect this, otherwise it is not possible to fine-grain ignore specific
complex portions of code in this manner.

[Bug debug/100523] New: [11/12 Regression] armv8.1-m.main -fcompare-debug failure with -O -fmodulo-sched -mtune=cortex-a53

2021-05-11 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100523

Bug ID: 100523
   Summary: [11/12 Regression] armv8.1-m.main -fcompare-debug
failure with -O -fmodulo-sched -mtune=cortex-a53
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat test.c
int main_j;
int main() {
  long crc;
  for (; main_j; main_j--)
if (crc)
  crc = crc >> 1 ^ 20;
}
$ ./arm-eabi-gcc -c test.c -fcompare-debug -O -fmodulo-sched
-march=armv8.1-m.main -mfloat-abi=soft -mtune=cortex-a53
arm-eabi-gcc: error: test.c: '-fcompare-debug' failure

Obviously the choice of scheduling isn't sensible for this -march, but it
reveals a bug in any case.

[Bug c/100522] New: ICE: in extract_ops_from_tree, at gimple-expr.c:556

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100522

Bug ID: 100522
   Summary: ICE: in extract_ops_from_tree, at gimple-expr.c:556
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__GIMPLE
foo() {
  int t1;
  t1_1 = t1_1();
}

$ gcc-trunk -O0 mutant.c
mutant.c:1:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
1 | __GIMPLE
  | ^~~~
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | foo() {
  | ^~~
mutant.c: In function ‘foo’:
mutant.c:4:3: internal compiler error: in extract_ops_from_tree, at
gimple-expr.c:556
4 |   t1_1 = t1_1();
  |   ^~~~
0x6cbc8c extract_ops_from_tree(tree_node*, tree_code*, tree_node**,
tree_node**, tree_node**)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-expr.c:556
0xbe12d0 gimple_build_assign(tree_node*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple.c:436
0x952c1a c_parser_gimple_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:880
0x952c1a c_parser_gimple_compound_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:650
0x952c1a c_parser_gimple_compound_statement
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:381
0x954fa7 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/gimple-parser.c:253
0x944187 c_parser_declaration_or_fndef
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:2533
0x94b9d3 c_parser_external_declaration
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1777
0x94c439 c_parser_translation_unit
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:1650
0x94c439 c_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c/c-parser.c:21984
0x9ac765 c_common_parse_file()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/c-family/c-opts.c:1218
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/100521] New: ICE at -O2 and above: in verify_range, at value-range.cc:384

2021-05-11 Thread cnsun at uwaterloo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100521

Bug ID: 100521
   Summary: ICE at -O2 and above: in verify_range, at
value-range.cc:384
   Product: gcc
   Version: tree-ssa
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FUbEknNORK-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210511 (experimental) [master revision
:7db32cac8:aa891c56f25baac94db004e309d1b6e40b770a95] (GCC)

$ cat mutant.c
__builtin_clz(int a) { return __builtin_clz(a); }

$ gcc-trunk -O2 mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
1 | __builtin_clz(int a) { return __builtin_clz(a); }
  | ^
during GIMPLE pass: evrp
mutant.c: In function ‘__builtin_clz’:
mutant.c:1:1: internal compiler error: in verify_range, at value-range.cc:384
0x7ccac7 irange::verify_range()
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/value-range.cc:384
0x191c65b range_of_builtin_call(range_query&, irange&, gcall*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-range.cc:774
0x191d11a gimple_ranger::range_of_builtin_call(irange&, gcall*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-range.cc:900
0x191d11a gimple_ranger::range_of_call(irange&, gcall*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-range.cc:602
0x191e67d gimple_ranger::calc_stmt(irange&, gimple*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-range.cc:378
0x191ea14 gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-range.cc:1077
0x19197a2 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-range.cc:960
0x120fdb4 range_query::value_of_expr(tree_node*, gimple*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/value-query.cc:86
0x192b625 hybrid_folder::value_of_expr(tree_node*, gimple*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-ssa-evrp.c:235
0x10abf46 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree-ssa-propagate.c:816
0x18edc87 dom_walker::walk(basic_block_def*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/domwalk.c:309
0x10ab239 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/tree-ssa-propagate.c:987
0x192b28e execute_early_vrp
/tmp/tmp.FUbEknNORK-gcc-builder/gcc/gcc/gimple-ssa-evrp.c:349
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c++/100517] [12 Regression] ICE in rvalue, at cp/tree.c:946 since r12-620-g7a5dd3ed49d1b328

2021-05-11 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100517

Jason Merrill  changed:

   What|Removed |Added

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

--- Comment #3 from Jason Merrill  ---
Fixed.

[Bug c++/100517] [12 Regression] ICE in rvalue, at cp/tree.c:946 since r12-620-g7a5dd3ed49d1b328

2021-05-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100517

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:010d4a5047166037b316ed22331f3d99742f1f1d

commit r12-721-g010d4a5047166037b316ed22331f3d99742f1f1d
Author: Jason Merrill 
Date:   Tue May 11 09:53:20 2021 -0400

c++: ICE casting class to vector [PR100517]

My recent change to reject calling rvalue() with an argument of class type
crashes on this testcase, where we use rvalue() on what we expect to be an
argument of integer or vector type.  Fixed by checking first.

gcc/cp/ChangeLog:

PR c++/100517
* typeck.c (build_reinterpret_cast_1): Check intype on
cast to vector.

gcc/testsuite/ChangeLog:

PR c++/100517
* g++.dg/ext/vector41.C: New test.

[Bug bootstrap/100431] Fixes to enable compiling with -Werror=format-security

2021-05-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431

--- Comment #4 from Jakub Jelinek  ---
%< and %> are GCC diagnostics format specifiers, not printf.
They are more similar to e.g. GNU printf %m , something that doesn't take any
va_arg, but is interpreted.
Try
printf ("%m\n");
vs.
printf ("%s", "%m\n");
to see the difference.
Anyway, for this case either using the conditional directly in the
cpp_warning_with_line argument instead of in initializer of a temporary, or two
cpp_warning_with_line calls each with a separate string would do.
Anyway, I strongly doubt your patch covers everything, I can see e.g.
gcc/c/c-convert.c:81:31: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/c/c-typeck.c:3681:28: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/c/c-typeck.c:4433:42: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/c/c-typeck.c:6587:43: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/c/c-typeck.c:11679:42: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/c-family/c-common.c:6358:30: warning: format not a string literal and no
format arguments [-Wformat-security]
gcc/c-family/c-common.c:6362:33: warning: format not a string literal and no
format arguments [-Wformat-security]
gcc/fold-const.c:303:42: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/ipa-devirt.c:951:47: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/analyzer/program-state.cc:1153:20: warning: format not a string literal and
no format arguments [-Wformat-security]
gcc/diagnostic.c:1887:52: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/cp/cvt.c:725:26: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/cp/error.c:799:20: warning: spurious leading punctuation sequence ‘<’ in
format [-Wformat-diag]
gcc/cp/error.c:799:20: warning: spurious trailing punctuation sequence ‘>’ in
format [-Wformat-diag]
gcc/cp/error.c:799:20: warning: spurious leading punctuation sequence ‘<’ in
format [-Wformat-diag]
gcc/cp/error.c:799:20: warning: spurious trailing punctuation sequence ‘>’ in
format [-Wformat-diag]
gcc/cp/decl.c:3485:22: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/cp/typeck.c:4721:24: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/cp/typeck.c:6630:24: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/cp/pt.c:19640:20: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/collect2.c:2422:37: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/collect-utils.c:200:37: warning: format not a string literal and no format
arguments [-Wformat-security]
gcc/lto-wrapper.c:1606:31: warning: format not a string literal and no format
arguments [-Wformat-security]
and you've only touched the gcc/diagnostic.c case from that.

[Bug debug/100520] New: [11/12 Regression] aarch64: ‘-fcompare-debug’ failure with -fprofile-generate

2021-05-11 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100520

Bug ID: 100520
   Summary: [11/12 Regression] aarch64: ‘-fcompare-debug’ failure
with -fprofile-generate
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

With GCC 11 and trunk I'm seeing the following -fcompare-debug problem:

$ cat test.c
static int f() {}
$ aarch64-linux-gnu-gcc -c test.c -fcompare-debug -fprofile-generate
aarch64-linux-gnu-gcc: error: test.c: ‘-fcompare-debug’ failure

[Bug ipa/100513] [10/11 Regression] ICE: Segmentation fault (in lookup_page_table_entry) for bootstrap-O3 since r11-6411-gae99b315ba5b9e1c

2021-05-11 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513

--- Comment #24 from Jiu Fu Guo  ---
(In reply to rguent...@suse.de from comment #22)
> On Tue, 11 May 2021, guojiufu at gcc dot gnu.org wrote:
> 
cut..
> > Makefile:3001: recipe for target 'syscall.lo' failed
> 
> Yes, this was reported by Maxim as well, independent of this
> patch.  It's caused by sth else.

Thanks ;)

[Bug c++/100516] Unexpected -Wstringop-overread in deque initialization from empty initializer_list

2021-05-11 Thread vopl at bk dot ru via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100516

--- Comment #2 from vopl at bk dot ru ---
minimal reproduce code I have:

using size_t = decltype(sizeof(char));

class initializer
{
const char* _array;
size_t  _len;

public:
constexpr initializer() : _array{}, _len{} { }
constexpr const char* begin() const noexcept { return _array; }
constexpr const char* end() const noexcept { return _array + _len; }
};

/0/1/2/3/4/5/6/7
struct deque
{
char** _M_map;
char** _M_start;
char** _M_finish;

template  void _M_initialize_map(size_t);

deque(initializer nil)
{
const char* first = nil.begin();
const char* last = nil.end();

_M_initialize_map(static_cast(last - first));

for (char** cur_node = _M_start; cur_node != _M_finish; ++cur_node)
++first;

if (last != first)
__builtin_memmove(*_M_finish, first, static_cast(last -
first));
}
};

template  void deque::_M_initialize_map(size_t num_elements)
{
size_t num_nodes = (num_elements / size_t{2} + 1);

_M_map = new char*[8];

char** nstart = _M_map + (size_t{8} - num_nodes) / 2;

try
{
for (char** cur = nstart; cur == nstart; ++cur)
*nstart = new char;
}
catch(...)
{
throw;
}

_M_start = _M_finish = nstart;
}

/0/1/2/3/4/5/6/7
int main()
{
deque{initializer{}};
return 0;
}

[Bug ipa/100513] [10/11 Regression] ICE: Segmentation fault (in lookup_page_table_entry) for bootstrap-O3 since r11-6411-gae99b315ba5b9e1c

2021-05-11 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513

--- Comment #23 from Jiu Fu Guo  ---
Created attachment 50791
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50791=edit
the command to build syscall.o

[Bug bootstrap/100431] Fixes to enable compiling with -Werror=format-security

2021-05-11 Thread joey.dumont at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431

--- Comment #3 from Joey Dumont  ---
I had tested with a simple printf: 

#include 

#ifndef N_
# define N_(msgid) msgid
#endif

int
main(int argc, char* argv[]) {
  printf(N_("use of C++23 % integer constant"));
  printf(N_("use of C++23 %%> integer constant"));

  return 0;
}

which prints the same thing with or without the "%s" format string. 

I've been trying to trace where pfile->cb.diagnostic is set to see how the
output is actually processed, but I haven't found it yet. 

Thanks for the feedback!

[Bug ipa/100513] [10/11 Regression] ICE: Segmentation fault (in lookup_page_table_entry) for bootstrap-O3 since r11-6411-gae99b315ba5b9e1c

2021-05-11 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513

--- Comment #22 from rguenther at suse dot de  ---
On Tue, 11 May 2021, guojiufu at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513
> 
> --- Comment #21 from Jiu Fu Guo  ---
> When build the go on trunk with the patch, an error occur:
> In function 'syscall.forkExec':
> go1: error: address taken, but ADDRESSABLE bit not set
> PHI argument
> 
> for PHI node
> err$__object_77 = PHI 
> during GIMPLE pass: fre
> go1: internal compiler error: verify_ssa failed
> mv -f .deps/tsan_rtl_report.Tpo .deps/tsan_rtl_report.Plo
> 0x10fde5cf verify_ssa(bool, bool)
> /home/guojiufu/gcc/gcc-mainline-test/gcc/tree-ssa.c:1214
> 0x10aff4ef execute_function_todo
> /home/guojiufu/gcc/gcc-mainline-test/gcc/passes.c:2049
> 0x10b011c3 do_per_function
> /home/guojiufu/gcc/gcc-mainline-test/gcc/passes.c:1687
> 0x10b011c3 execute_todo
> /home/guojiufu/gcc/gcc-mainline-test/gcc/passes.c:2096
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See  for instructions.
> Makefile:3001: recipe for target 'syscall.lo' failed

Yes, this was reported by Maxim as well, independent of this
patch.  It's caused by sth else.

[Bug ipa/100513] [10/11 Regression] ICE: Segmentation fault (in lookup_page_table_entry) for bootstrap-O3 since r11-6411-gae99b315ba5b9e1c

2021-05-11 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513

--- Comment #21 from Jiu Fu Guo  ---
When build the go on trunk with the patch, an error occur:
In function 'syscall.forkExec':
go1: error: address taken, but ADDRESSABLE bit not set
PHI argument

for PHI node
err$__object_77 = PHI 
during GIMPLE pass: fre
go1: internal compiler error: verify_ssa failed
mv -f .deps/tsan_rtl_report.Tpo .deps/tsan_rtl_report.Plo
0x10fde5cf verify_ssa(bool, bool)
/home/guojiufu/gcc/gcc-mainline-test/gcc/tree-ssa.c:1214
0x10aff4ef execute_function_todo
/home/guojiufu/gcc/gcc-mainline-test/gcc/passes.c:2049
0x10b011c3 do_per_function
/home/guojiufu/gcc/gcc-mainline-test/gcc/passes.c:1687
0x10b011c3 execute_todo
/home/guojiufu/gcc/gcc-mainline-test/gcc/passes.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.
Makefile:3001: recipe for target 'syscall.lo' failed

[Bug tree-optimization/100400] ICE in visit_loops_in_gang_single_region

2021-05-11 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100400

Martin Liška  changed:

   What|Removed |Added

 Status|WAITING |NEW
 CC||tschwinge at gcc dot gnu.org

--- Comment #4 from Martin Liška  ---
Sorry, my bad, I used C compiler.
Started with r11-8242-g3395dfc4da8ad1fc.

[Bug tree-optimization/100400] ICE in visit_loops_in_gang_single_region

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

--- Comment #3 from Arseny Solokha  ---
% cat .c.008t.omp_oacc_kernels_decompose

;; Function foo (_Z3foov, funcdef_no=0, decl_uid=2487, cgraph_uid=1,
symbol_order=1)




EMERGENCY DUMP:

void foo ()
{
  # DEBUG BEGIN_STMT
  #pragma omp target oacc_kernels map(force_tofrom:p [len: 8])
{
  int c.0;

  # DEBUG BEGIN_STMT
  try
{
  # DEBUG BEGIN_STMT
  # DEBUG BEGIN_STMT
  p = 
  # DEBUG BEGIN_STMT
  #pragma acc loop independent private(c.0) private(c)
  for (c.0 = 0; c.0 < 1; c.0 = c.0 + 1)
{
  c = c.0;
  # DEBUG BEGIN_STMT
}
}
  finally
{
  c = {CLOBBER};
}
}
}

[Bug tree-optimization/100400] ICE in visit_loops_in_gang_single_region

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

--- Comment #2 from Arseny Solokha  ---
% g++-12.0.0 -v
Using built-in specs.
COLLECT_GCC=g++-12.0.0
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20210509/work/gcc-12-20210509/configure
--host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-unknown-linux-gnu/gcc-bin/12.0.0
--includedir=/usr/lib/gcc/x86_64-unknown-linux-gnu/12.0.0/include
--datadir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/12.0.0
--mandir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/12.0.0/man
--infodir=/usr/share/gcc-data/x86_64-unknown-linux-gnu/12.0.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-unknown-linux-gnu/12.0.0/include/g++-v12
--with-python-dir=/share/gcc-data/x86_64-unknown-linux-gnu/12.0.0/python
--enable-languages=c,c++ --enable-obsolete --enable-secureplt --disable-werror
--with-system-zlib --disable-nls --enable-checking=yes --disable-esp
--enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --with-multilib-list=m64 --disable-fixed-point
--enable-targets=all --enable-libgomp --disable-libssp --disable-libada
--disable-systemtap --enable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --without-zstd --enable-lto --with-isl
--disable-isl-version-check --disable-libsanitizer --enable-default-pie
--enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210509 (experimental) (GCC)

https://gcc.godbolt.org/z/3MajcK6q3

[Bug ipa/100513] [10/11 Regression] ICE: Segmentation fault (in lookup_page_table_entry) for bootstrap-O3 since r11-6411-gae99b315ba5b9e1c

2021-05-11 Thread guojiufu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100513

--- Comment #20 from Jiu Fu Guo  ---
Yes, with the patch, bootstrap-O3 pass on ppc64le too.

Thanks!

[Bug target/100497] [OpenMP][nvptx] libgomp.c-c++-common/reduction-5.c - fails on some nvptx systems

2021-05-11 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100497

--- Comment #11 from Jakub Jelinek  ---
(In reply to Tobias Burnus from comment #10)
> Oddly, if one replaces
> 
>  #pragma omp target teams distribute parallel for reduction(||: orfc)
> map(orfc)
> 
> by
> 
>  #pragma omp target map(orfc)
>  {
>   #pragma teams distribute parallel for reduction(||: orfc)

Missing omp before teams.

  1   2   >