[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-04-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #13 from GCC Commits  ---
The trunk branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:628aecb050bbbc4bb0bd4468c474623e20d64e21

commit r15-9501-g628aecb050bbbc4bb0bd4468c474623e20d64e21
Author: Jason Merrill 
Date:   Tue Apr 15 11:23:57 2025 -0400

c++: constexpr, trivial, and non-alias target [PR111075]

On Darwin and other targets with !can_alias_cdtor, we instead go to
maybe_thunk_ctor, which builds a thunk function that calls the general
constructor.  And then cp_fold tries to constant-evaluate that call, and we
ICE because we don't expect to ever be asked to constant-evaluate a call to
a trivial function.

No new test because this fixes g++.dg/torture/tail-padding1.C on affected
targets.

PR c++/111075

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_call_expression): Allow trivial
call from a thunk.

[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-04-15 Thread iains at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #12 from Iain Sandoe  ---
(In reply to Jason Merrill from comment #11)
> Created attachment 61123 [details]
> fix
> 
> This seems like an appropriate fix, can someone test it on an affected
> target?

A spot-check on x86_64 darwin21 shows that this test is fixed by the patch. 
Full regtest will follow.

[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-04-15 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Jason Merrill  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #11 from Jason Merrill  ---
Created attachment 61123
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61123&action=edit
fix

This seems like an appropriate fix, can someone test it on an affected target?

[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-04-15 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Jason Merrill  changed:

   What|Removed |Added

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

[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-02-10 Thread danglin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #10 from John David Anglin  ---
Another bit of information:

Breakpoint 5, type_has_trivial_fn (ctype=0x83ffbfeb1f18,
sfk=sfk_copy_constructor) at ../../gcc/gcc/cp/method.cc:399
399   switch (sfk)
(gdb) p debug_tree (ctype)
  constant 64>
unit-size  constant 8>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
83ffbfeb1f18
fields 
DI size  unit-size 
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
83ffbfed0bd0 method basetype 
arg-types 
chain 
chain >>>
throws >
pointer_to_this >
addressable used nothrow public static deprecated external weak
autoinline decl_3 decl_5 decl_8 SI defer-output
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:6:8
align:64 warn_if_not_align:0 context  initial

result 
ignored VOID
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:6:8
align:8 warn_if_not_align:0 context >
full-name "constexpr X::X(const X&) noexcept"
not-really-extern
arguments 
readonly unsigned read DI
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:10:11 size
 unit-size 
align:64 warn_if_not_align:0 context  arg-type  chain
>
struct-function 83ffbff4f4e0
chain 
used public static deprecated weak autoinline decl_3 decl_5 decl_8
SI /home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:6:8
align:64 warn_if_not_align:0 context  initial
 result 
full-name "constexpr X::X(const X&) noexcept" arguments 
struct-function 83ffbff4f5b0 chain >> context 
full-name "struct X"
needs-destructor X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
pointer_to_this  reference_to_this
 chain >
$18 = void

This code returns true:
case sfk_copy_constructor:
  return !TYPE_HAS_COMPLEX_COPY_CTOR (ctype);

(gdb) bt
#0  type_has_trivial_fn (ctype=0x83ffbfeb1f18, sfk=sfk_copy_constructor)
at ../../gcc/gcc/cp/method.cc:399
#1  0x40a1b0bc in trivial_fn_p (fn=)
at ../../gcc/gcc/tree.h:3834
#2  0x408ac244 in cxx_eval_call_expression (ctx=0x83ffbfff3420,
t=0x83ffbfed30c0, lval=vc_prvalue, non_constant_p=0x83ffbfff3471,
overflow_p=0x83ffbfff3470) at ../../gcc/gcc/cp/constexpr.cc:3051
#3  0x408b1164 in cxx_eval_constant_expression (
ctx=0x83ffbfed30c0, t=, lval=,
non_constant_p=0x83ffbfff3471,
overflow_p=0x800100438800 ,
jump_target=0x83ffbfff3420) at ../../gcc/gcc/cp/constexpr.cc:7725
#4  0x408c3308 in cxx_eval_outermost_constant_expr (
t=0x83ffbfed30c0, allow_non_constant=,
strict=, manifestly_const_eval=,
constexpr_dtor=, object=0x83ffbfeb1f18)
at ../../gcc/gcc/cp/constexpr.cc:9020
#5  0x408cb064 in maybe_constant_value (t=,
decl=0x83ffbfff3420, manifestly_const_eval=-1074974528)
at ../../gcc/gcc/cp/constexpr.cc:9323
[...]

[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-02-10 Thread danglin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #9 from John David Anglin  ---
(gdb) p debug_tree (fun)
 >
DI
size 
unit-size 
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
83ffbfed0bd0 method basetype 
arg-types 
chain 
chain >>>
throws >
pointer_to_this >
addressable used nothrow public static deprecated external weak autoinline
decl_3 decl_5 decl_8 SI defer-output
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:6:8
align:64 warn_if_not_align:0 context  initial

result 
ignored VOID
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:6:8
align:8 warn_if_not_align:0 context >
full-name "constexpr X::X(const X&) noexcept"
not-really-extern
arguments 
readonly public unsigned DI size 
unit-size 
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
83ffbfeb1690>
readonly unsigned read DI
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:10:11 size
 unit-size 
align:64 warn_if_not_align:0 context  arg-type 
chain 
readonly unsigned read DI
/home/dave/gnu/gcc/gcc/gcc/testsuite/g++.dg/torture/tail-padding1.C:10:11 size
 unit-size 
align:64 warn_if_not_align:0 context  arg-type >>
struct-function 83ffbff4f4e0 chain >
$7 = void

[Bug c++/111075] [13/14/15 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin since r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7

2025-02-10 Thread danglin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #8 from John David Anglin  ---
trivial_fn_p (fun) returns true.