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

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
#1  0x0000000000ff9947 in build_compound_literal (loc=972032,
type=0x7ffff761d5e8, init=0x7ffff77dc4f8, non_const=false, alignas_align=0,
scspecs=0x52e6710) at
/home/apinski/src/upstream-gcc-git/gcc/gcc/c/c-decl.cc:6530


6527      if (current_scope != file_scope
6528          && TREE_STATIC (decl)
6529          && !TREE_READONLY (decl)
6530          && DECL_DECLARED_INLINE_P (current_function_decl)
6531          && DECL_EXTERNAL (current_function_decl))
6532        record_inline_static (input_location, current_function_decl,
6533                              decl, csi_modifiable);

The ICE here is because the current scope is not an the file level scope (we
are in the function scope) but the current_function_decl is NULL as the decl
for the function is not allocated yet.

So maybe just a `&& !current_function_decl` is needed?

Because the question is:
```
inline void func(int x[(static int){12}]) {}
```
I think this becomes its own compound literal decl so we don't need to record
the inline static here.  But I still could be wrong.

Reply via email to