[Bug c++/111929] [14 Regression] in decompose, at wide-int.h:1049 since r14-4793-gdad311874ac3b3

2023-10-27 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111929

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

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

commit r14-4979-g6ff8b93c7b0bf3913fb7754f9985e7e31c46d89c
Author: Patrick Palka 
Date:   Fri Oct 27 11:31:02 2023 -0400

c++: another build_new_1 folding fix [PR111929]

In build_new_1, we also need to avoid folding 'outer_nelts_check' when
in a template context to prevent an ICE on the below testcase.  This
patch replaces the problematic fold_build2 call with build2 (we'll later
fold it if appropriate during cp_fully_fold).

In passing, this patch removes an unnecessary conversion of 'nelts'
since it should always already be a size_t (and 'convert' isn't the best
conversion entry point to use anyway since it lacks a complain parameter).

PR c++/111929

gcc/cp/ChangeLog:

* init.cc (build_new_1): Remove unnecessary call to convert
on 'nelts'.  Use build2 instead of fold_build2 for
'outer_nelts_checks'.

gcc/testsuite/ChangeLog:

* g++.dg/template/non-dependent28a.C: New test.

[Bug c++/111929] [14 Regression] in decompose, at wide-int.h:1049 since r14-4793-gdad311874ac3b3

2023-10-24 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111929

Patrick Palka  changed:

   What|Removed |Added

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

--- Comment #11 from Patrick Palka  ---
Fixed, hopefully

[Bug c++/111929] [14 Regression] in decompose, at wide-int.h:1049 since r14-4793-gdad311874ac3b3

2023-10-24 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111929

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

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

commit r14-4899-gd80a26cca025877b7657fa355570bc301223b50b
Author: Patrick Palka 
Date:   Tue Oct 24 18:03:17 2023 -0400

c++: non-dep array new-expr size [PR111929]

This PR is another instance of NON_DEPENDENT_EXPR having acted as an
"analysis barrier" for middle-end routines, and now that it's gone we're
more prone to passing weird templated trees (that have a generic tree
code) to middle-end routines which end up ICEing on such trees.

In the testcase below the non-dependent array new-expr size 'x + 42' is
expressed as an ordinary PLUS_EXPR, but whose operands have different
types (since templated trees encode just the syntactic form of an
expression devoid of e.g. implicit conversions).  This type incoherency
triggers an ICE from size_binop in build_new_1 due to a wide_int assert
that expects the operand types to have the same precision.

This patch fixes this by replacing our piecemeal folding of 'size' in
build_new_1 with a single call to cp_fully_fold (which is a no-op in a
template context) once 'size' is built up.

PR c++/111929

gcc/cp/ChangeLog:

* init.cc (build_new_1): Use convert, build2, build3 and
cp_fully_fold instead of fold_convert, size_binop and
fold_build3 when building up 'size'.

gcc/testsuite/ChangeLog:

* g++.dg/template/non-dependent28.C: New test.

[Bug c++/111929] [14 Regression] in decompose, at wide-int.h:1049 since r14-4793-gdad311874ac3b3

2023-10-24 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111929

--- Comment #9 from Sam James  ---
Hit this with libsass too.

[Bug c++/111929] [14 Regression] in decompose, at wide-int.h:1049 since r14-4793-gdad311874ac3b3

2023-10-23 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111929

Sam James  changed:

   What|Removed |Added

   Keywords|needs-bisection |
Summary|[14 Regression] in  |[14 Regression] in
   |decompose, at   |decompose, at
   |wide-int.h:1049 |wide-int.h:1049 since
   ||r14-4793-gdad311874ac3b3

--- Comment #8 from Sam James  ---
dad311874ac3b3cf4eca1c04f67cae80c953f7b8 is the first bad commit
commit dad311874ac3b3cf4eca1c04f67cae80c953f7b8
Author: Patrick Palka 
Date:   Fri Oct 20 10:45:00 2023 -0400

c++: remove NON_DEPENDENT_EXPR, part 1

i.e. r14-4793-gdad311874ac3b3