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

            Bug ID: 121216
           Summary: internal compiler error: in tree_to_uhwi, at
                    tree.cc:6660 since 13.1 with -std=c2x
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mario.rodriguezb1 at um dot es
  Target Milestone: ---

ICE when using std=c2x, but if you remove it it compiles succesfully.


Program:

```
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    const char *key = "obscurelevelofabstraction";
    const char reverse_key[strlen(key)] = {'\0'};
    printf("reverse_key contains %zu characters\n", strlen(reverse_key));
}
```

Stack dump:

```
<source>:7:5: internal compiler error: in tree_to_uhwi, at tree.cc:6660
    7 |     printf("reverse_key contains %zu characters\n",
strlen(reverse_key));
      |     ^~~~~~
0x2547d65 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2569a46 internal_error(char const*, ...)
        ???:0
0xa014de fancy_abort(char const*, int, char const*)
        ???:0
0xd43078 getbyterep(tree_node*, unsigned long*)
        ???:0
0xd7f62f fold_const_call(combined_fn, tree_node*, tree_node*)
        ???:0
0xd7262b fold(tree_node*)
        ???:0
0xad046e c_fully_fold(tree_node*, bool, bool*, bool)
        ???:0
0xa69df2 build_function_call_vec(unsigned long, vec<unsigned long, va_heap,
vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*, vec<tree_node*, va_gc,
vl_embed>*, tree_node*)
        ???:0
0xacc7ce c_parse_file()
        ???:0
0xb4e6e9 c_common_parse_file()
        ???:0
```

To quickly reproduce:

https://godbolt.org/z/efhxEb1cs

Reply via email to