public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin
@ 2023-08-19 14:16 fxcoudert at gcc dot gnu.org
  2023-08-19 14:17 ` [Bug c++/111075] " fxcoudert at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-08-19 14:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

            Bug ID: 111075
           Summary: ICE on g++.dg/torture/tail-padding1.C on darwin
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

ICE on valid C++ code, reduced from the test failure of
g++.dg/torture/tail-padding1.C observed on x86_64-apple-darwin20 (see for
example at
https://gcc.gnu.org/pipermail/gcc-testresults/2023-August/793205.html):

$ cat z.C
struct X { ~X() {} int n; char d; };
struct Y { Y(); char c[3]; };
struct Z : X, virtual Y { Z(); };

X f() { X nrvo; __builtin_memset(&nrvo, 0, sizeof(X)); return nrvo; }
Z::Z() : Y(), X(f()) {}

$ /tmp/irun/bin/g++ -Os z.C   
z.C: In copy constructor ‘constexpr X::X(const X&)’:
z.C:1:8: internal compiler error: in cxx_eval_call_expression, at
cp/constexpr.cc:2918
    1 | struct X { ~X() {} int n; char d; };
      |        ^

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
@ 2023-08-19 14:17 ` fxcoudert at gcc dot gnu.org
  2023-09-08 20:52 ` fxcoudert at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-08-19 14:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-apple-darwin20
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-08-19
              Build|                            |x86_64-apple-darwin20
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |14.0
               Host|                            |x86_64-apple-darwin20

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
  2023-08-19 14:17 ` [Bug c++/111075] " fxcoudert at gcc dot gnu.org
@ 2023-09-08 20:52 ` fxcoudert at gcc dot gnu.org
  2024-03-04 13:01 ` [Bug c++/111075] [14 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-09-08 20:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #1 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Preprocessed source:

% cat a-tail-padding1.ii                                                        
# 0 "/Users/fx/gcc-upstream/gcc/testsuite/g++.dg/torture/tail-padding1.C"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/Users/fx/gcc-upstream/gcc/testsuite/g++.dg/torture/tail-padding1.C"





struct X { ~X() {} int n; char d; };
struct Y { Y(); char c[3]; };
struct Z : X, virtual Y { Z(); };

X f() { X nrvo; __builtin_memset(&nrvo, 0, sizeof(X)); return nrvo; }
Z::Z() : Y(), X(f()) {}
Y::Y() { c[0] = 1; }

int main() {
  Z z;
  if (z.c[0] != 1)
    __builtin_abort ();
}


Backtrace of the ICE:

  * frame #0: 0x0000000101b76378 cc1plus`internal_error(char const*, ...)
[inlined] auto_diagnostic_group::auto_diagnostic_group(this=<unavailable>) at
diagnostic.cc:2320:14
    frame #1: 0x0000000101b76378 cc1plus`internal_error(gmsgid="in %s, at
%s:%d")
    frame #2: 0x0000000101f92296
cc1plus`fancy_abort(file="/Users/fx/gcc-upstream/gcc/cp/constexpr.cc",
line=2918, function="cxx_eval_call_expression") at diagnostic.cc:2311:18
    frame #3: 0x0000000101c8254e
cc1plus`::__second_sect_of_cxx_eval_call_expression() at constexpr.cc:2918:3
    frame #4: 0x0000000100054f3b
cc1plus`::cxx_eval_constant_expression(ctx=0x00007ff7bfefe500, t=<unavailable>,
lval=vc_prvalue, non_constant_p=0x00007ff7bfefe4ee,
overflow_p=0x00007ff7bfefe4ef, jump_target=0x0000000000000000) at
constexpr.cc:7257:36
    frame #5: 0x0000000100060156
cc1plus`::cxx_eval_outermost_constant_expr(t=0x00000001045b9880,
allow_non_constant=true, strict=<unavailable>, manifestly_const_eval=mce_false,
constexpr_dtor=false, object=0x0000000000000000) at constexpr.cc:8500:36
    frame #6: 0x000000010006601c cc1plus`maybe_constant_value(t=<unavailable>,
decl=0x0000000000000000, manifestly_const_eval=mce_false) at
constexpr.cc:8788:45
    frame #7: 0x0000000100091cf1 cc1plus`::cp_fold(x=<unavailable>,
flags=<unavailable>) at cp-gimplify.cc:3052:31
    frame #8: 0x0000000100091f46 cc1plus`::cp_fold_r(stmt_p=0x00000001045a3ca0,
walk_subtrees=0x00007ff7bfefe8dc, data_=0x00007ff7bfefe9a0) at
cp-gimplify.cc:1077:28
    frame #9: 0x0000000101952268 cc1plus`walk_tree_1(tp=<unavailable>,
func=<unavailable>, data=0x00007ff7bfefe9a0, pset=<unavailable>,
lh=(cc1plus`cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**,
int*, void*), void*, hash_set<tree_node*, false,
default_hash_traits<tree_node*> >*) at tree.cc:5453:1))(tree_node**, int*,
void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) at
tree.cc:11398:25
    frame #10: 0x0000000101952f0a cc1plus`walk_tree_1(tp=<unavailable>,
func=<unavailable>, data=0x00007ff7bfefe9a0, pset=<unavailable>,
lh=(cc1plus`cp_walk_subtrees(tree_node**, int*, tree_node* (*)(tree_node**,
int*, void*), void*, hash_set<tree_node*, false,
default_hash_traits<tree_node*> >*) at tree.cc:5453:1))(tree_node**, int*,
void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) at
tree.cc:11514:4
    frame #11: 0x0000000100087c18
cc1plus`cp_fold_function(fndecl=0x00000001045be000) at cp-gimplify.cc:1199:3
    frame #12: 0x00000001000dc0b9
cc1plus`finish_function(inline_p=<unavailable>) at decl.cc:18345:22
    frame #13: 0x00000001001938bf
cc1plus`::maybe_thunk_body(fn=0x00000001045b4e00, force=<unavailable>) at
optimize.cc:445:26
    frame #14: 0x000000010019443a
cc1plus`maybe_clone_body(fn=0x00000001045b4e00) at optimize.cc:557:38
    frame #15: 0x0000000100278978
cc1plus`expand_or_defer_fn_1(fn=0x00000001045b4e00) at semantics.cc:4901:24
    frame #16: 0x0000000100278c5e
cc1plus`expand_or_defer_fn(fn=0x00000001045b4e00) at semantics.cc:4932:28
    frame #17: 0x000000010013c6d8
cc1plus`synthesize_method(fndecl=<unavailable>) at method.cc:1842:24
    frame #18: 0x00000001000ee7c2 cc1plus`mark_used(decl=0x00000001045be000,
complain=<unavailable>) at decl2.cc:5855:25
    frame #19: 0x000000010002016b cc1plus`::build_over_call(cand=<unavailable>,
flags=<unavailable>, complain=3) at call.cc:10403:21
    frame #20: 0x000000010001d900
cc1plus`build_new_method_call(instance=0x00000001044305d0,
fns=0x0000000104591f20, args=<unavailable>, conversion_path=<unavailable>,
flags=1, fn_p=0x0000000000000000, complain=3) at call.cc:11710:31
    frame #21: 0x000000010001eac0
cc1plus`build_special_member_call(instance=<unavailable>,
name=0x0000000104422100, args=0x00007ff7bfeff110, binfo=<unavailable>, flags=1,
complain=3) at call.cc:11190:31
    frame #22: 0x000000010010fc1d cc1plus`::expand_aggr_init_1(tree, tree,
tree, tree, int, tsubst_flags_t) at init.cc:2203:40
    frame #23: 0x000000010010fb34
cc1plus`::expand_aggr_init_1(binfo=0x00000001045b02a0,
true_exp=0x0000000000000000, exp=0x00000001044305d0, init=<unavailable>,
flags=1, complain=3)
    frame #24: 0x0000000100117964
cc1plus`emit_mem_initializers(mem_inits=<unavailable>) at init.cc:1562:23
    frame #25: 0x00000001001ebec0
cc1plus`::cp_parser_ctor_initializer_opt_and_function_body(parser=0x00000001045ac150,
in_function_try_block=false) at parser.cc:17188:29
    frame #26: 0x00000001001ed6e0
cc1plus`::cp_parser_function_definition_after_declarator(parser=0x00000001045ac150,
inline_p=false) at parser.cc:32243:7
    frame #27: 0x00000001001eecbe
cc1plus`::cp_parser_init_declarator(parser=0x00000001045ac150,
flags=<unavailable>, decl_specifiers=0x00007ff7bfeff4b0,
checks=0x0000000000000000, function_definition_allowed_p=<unavailable>,
member_p=false, declares_class_or_enum=0,
function_definition_p=0x00007ff7bfeff550,
maybe_range_for_decl=0x0000000000000000, init_loc=0x00007ff7bfeff474,
auto_result=0x00007ff7bfeff5f0) at parser.cc:32160:59
    frame #28: 0x00000001001bcf23
cc1plus`::cp_parser_simple_declaration(parser=0x00000001045ac150,
function_definition_allowed_p=<unavailable>,
maybe_range_for_decl=0x0000000000000000) at parser.cc:15607:40
    frame #29: 0x00000001001f63ed
cc1plus`::cp_parser_declaration(parser=0x00000001045ac150,
prefix_attrs=0x0000000000000000) at parser.cc:15293:33
    frame #30: 0x00000001001f8bf4 cc1plus`c_parse_file() at parser.cc:15314:27
    frame #31: 0x000000010034fede cc1plus`c_common_parse_file() at
c-opts.cc:1257:20
    frame #32: 0x00000001015b5ce4 cc1plus`::compile_file() at toplev.cc:444:25
    frame #33: 0x0000000101f96942 cc1plus`toplev::main(this=0x00007ff7bfeff92e,
argc=<unavailable>, argv=<unavailable>) at toplev.cc:2126:24
    frame #34: 0x0000000101f9712e cc1plus`main(argc=6, argv=0x00007ff7bfeffa78)
at main.cc:39:23

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] [14 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
  2023-08-19 14:17 ` [Bug c++/111075] " fxcoudert at gcc dot gnu.org
  2023-09-08 20:52 ` fxcoudert at gcc dot gnu.org
@ 2024-03-04 13:01 ` rguenth at gcc dot gnu.org
  2024-03-07 23:24 ` law at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-04 13:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] [14 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-04 13:01 ` [Bug c++/111075] [14 Regression] " rguenth at gcc dot gnu.org
@ 2024-03-07 23:24 ` law at gcc dot gnu.org
  2024-03-13 13:26 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-07 23:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
                 CC|                            |law at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] [14 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-07 23:24 ` law at gcc dot gnu.org
@ 2024-03-13 13:26 ` mpolacek at gcc dot gnu.org
  2024-03-27 15:30 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-03-13 13:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
darwin -> probably not P1.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] [14 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-13 13:26 ` mpolacek at gcc dot gnu.org
@ 2024-03-27 15:30 ` jakub at gcc dot gnu.org
  2024-03-27 16:30 ` [Bug c++/111075] [13/14 " jakub at gcc dot gnu.org
  2024-03-27 17:36 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-27 15:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I can reproduce with a cross, doesn't ICE with -Os -fno-elide-constructors, on
x86_64-linux doesn't ICE with/without -Os -f{,no-}elide-constructors.
The ICE is on
3025      /* We used to shortcut trivial constructor/op= here, but nowadays
3026         we can only get a trivial function here with
-fno-elide-constructors.  */
3027      gcc_checking_assert (!trivial_fn_p (fun)
3028                           || !flag_elide_constructors
3029                           /* We don't elide constructors when processing
3030                              a noexcept-expression.  */
3031                           || cp_noexcept_operand);
where fun is X::X(X const&) and is trivial.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] [13/14 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-27 15:30 ` jakub at gcc dot gnu.org
@ 2024-03-27 16:30 ` jakub at gcc dot gnu.org
  2024-03-27 17:36 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-27 16:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[14 Regression] ICE on      |[13/14 Regression] ICE on
                   |g++.dg/torture/tail-padding |g++.dg/torture/tail-padding
                   |1.C on darwin               |1.C on darwin
   Target Milestone|14.0                        |13.3

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Actually, it doesn't seem to be a regression from 13.x, if one builds 13 branch
with --enable-checking=yes rather than --enable-checking=release, it ICEs too.
12 branch doesn't ICE though.
So P2 is right.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/111075] [13/14 Regression] ICE on g++.dg/torture/tail-padding1.C on darwin
  2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-03-27 16:30 ` [Bug c++/111075] [13/14 " jakub at gcc dot gnu.org
@ 2024-03-27 17:36 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-27 17:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111075

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r13-6145-gb2287a4d9a640fdc2caef6a067830ea65044deb7
I must say I have no idea what is different from this POV on Darwin vs. Linux.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-27 17:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-19 14:16 [Bug c++/111075] New: ICE on g++.dg/torture/tail-padding1.C on darwin fxcoudert at gcc dot gnu.org
2023-08-19 14:17 ` [Bug c++/111075] " fxcoudert at gcc dot gnu.org
2023-09-08 20:52 ` fxcoudert at gcc dot gnu.org
2024-03-04 13:01 ` [Bug c++/111075] [14 Regression] " rguenth at gcc dot gnu.org
2024-03-07 23:24 ` law at gcc dot gnu.org
2024-03-13 13:26 ` mpolacek at gcc dot gnu.org
2024-03-27 15:30 ` jakub at gcc dot gnu.org
2024-03-27 16:30 ` [Bug c++/111075] [13/14 " jakub at gcc dot gnu.org
2024-03-27 17:36 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).