https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114831
Bug ID: 114831 Summary: typeof doesn't evaluate expression when it has variably modified type in some cases Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mforney at mforney dot org Target Milestone: --- C23 introduced typeof, and 6.7.2.5p4 says > If the type of the operand is a variably modified type, the operand > is evaluated; otherwise, the operand is not evaluated. However, gcc doesn't evaluate the operand when it has variably modified type in some cases. Consider the following program: #include <stdio.h> int n = 1; int main(void) { int a[n], (*p)[n] = 0; typeof(puts("&a is variably-modified"), &a) p1; typeof(puts("p is variably-modified"), p) p2; typeof(puts("p1 is variably-modified"), p1) p3; typeof(puts("p2 is variably-modified"), p2) p4; } All four of the typeof operands have the same type, int (*)[n]. But when I run this program it prints just: p is variably-modified p2 is variably-modified