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

            Bug ID: 116495
           Summary: Crash on va_arg with variable size type
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hnarkaytis at gmail dot com
  Target Milestone: ---

x86-64 gcc (trunk)

#include <stdarg.h>

void * foo (int size, ...)
{
  va_list va_args;
  __builtin_va_start (va_args, size);
  void * ptr = __builtin_va_arg (va_args, char[size]);
  __builtin_va_end (va_args);
  return (ptr);
}

int main ()
{
  foo (sizeof (0), 0);
  return (0);
}


<source>: In function 'foo':
<source>:7:43: internal compiler error: in force_constant_size, at
gimplify.cc:771
    7 |   void * ptr = __builtin_va_arg (va_args, char[size]);
      |                                           ^~~~
0x246f2a5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
        ???:0
0x24813f5 internal_error(char const*, ...)
        ???:0
0x98e9f6 fancy_abort(char const*, int, char const*)
        ???:0
0xd5da37 gimple_add_tmp_var(tree_node*)
        ???:0
0xd1105b create_tmp_var(tree_node*, char const*)
        ???:0
0xd6649f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd67652 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd66dff gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd6a5da gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd67639 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd6a5da gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd682c3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd6a5da gimplify_stmt(tree_node**, gimple**)
        ???:0
0xd67935 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ???:0
0xd70723 gimplify_body(tree_node*, bool)
        ???:0
0xd70b69 gimplify_function_tree(tree_node*)
        ???:0
0xb916f7 cgraph_node::analyze()
        ???:0
0xb94a51 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

Reply via email to