Bugzilla – Bug 81
CFrontend crashes when compiling C99 compound expressions in structure constructors
Last modified: 2003-11-01 18:24:09
You need to log in before you can comment on or make changes to this bug.
Reduced from linux-2.4.22/kernel/kmod.c:call_usermodehelper(). Ordinary gcc accepts this code, which makes use of the ancient pre-C99 syntax for partial structure initialization, so it's technically a "C extension". Linux seems to use this syntax a lot. 419 gally> cat kmod4.c typedef struct { int foo; } spinlock_t; typedef struct wait_queue_head_t { spinlock_t lock; } wait_queue_head_t; void call_usermodehelper(void) { struct wait_queue_head_t work = { lock: (spinlock_t) { 0 }, }; } 420 gally> llvm-gcc -c kmod4.c kmod4.c: In function `call_usermodehelper': kmod4.c:3: internal compiler error: tree check: expected constructor, have compound_literal_expr in llvm_expand_constructor_elements, at llvm-expand.c:3305
It doesn't seem to like the C99 syntax (... { .lock = (spinlock_t) ...) either.
Fixed. Testcase: test/Regression/CFrontend/2003-11-01-C99-CompoundLiteral.c Thanks! -Chris