https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114723
Bug ID: 114723
Summary: ICE when checking for type compatibility with
structure that contains flexible array member
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: luigighiron at gmail dot com
Target Milestone: ---
The following code causes an internal compiler error on GCC 14:
#include<stdio.h>
struct S{int x,y[1];}*a;
int main(void){
struct S{int x,y[];};
puts(_Generic(
a,
struct S*:"compatible",
default:"incompatible"
));
}
If I understand the type compatibility rules, these types should be compatible?
The types "int[1]" and "int[]" are compatible and everything else seems to
match exactly. Interestingly, it seems to also crash when checking if the type
of a is compatible with struct S (instead of struct S*).