[Bug c++/105946] [12/13 Regression] ICE in maybe_warn_pass_by_reference, at tree-ssa-uninit.cc:843

2022-06-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105946

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

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

commit r13-1086-ge07a876c07601e1f3a27420f7d055d20193c362c
Author: Richard Biener 
Date:   Tue Jun 14 11:10:13 2022 +0200

tree-optimization/105946 - avoid accessing excess args from uninit diag

uninit diagnostics uses passing via reference and access attributes
but that iterates over function type arguments which can in some
cases appearantly outrun the actual arguments leading to ICEs.
The following simply ignores not present arguments.

2022-06-14  Richard Biener  

PR tree-optimization/105946
* tree-ssa-uninit.cc (maybe_warn_pass_by_reference):
Do not look at arguments not specified in the function call.

[Bug c++/105946] [12/13 Regression] ICE in maybe_warn_pass_by_reference, at tree-ssa-uninit.cc:843

2022-06-14 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105946

Richard Biener  changed:

   What|Removed |Added

   Last reconfirmed||2022-06-14
   Priority|P3  |P2
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Keywords||needs-reduction
   Target Milestone|--- |12.2
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #1 from Richard Biener  ---
Confirmed.

(gdb) p debug_gimple_stmt (stmt)
# .MEM_8 = VDEF <.MEM_7(D)>
_2 = std::__new_allocator >::allocate (__n_1(D), 0B);

842   tree arg = gimple_call_arg (stmt, argno - 1);
(gdb) p argno
$2 = 3
(gdb) p debug_generic_expr (fntype)
struct vector * __new_allocator:: (struct __new_allocator *, size_type,
const void *)

so the number of actual arguments does not match the function type of the call.

I have a simple patch.