Closed llvmbot closed 13 years ago
Yes, dragonegg handles this correctly.
Fixed in clang, and presumably dragonegg.
It's crashing at line 1247 of llvm-types.cpp, presumably because TYPE_SIZE(ArgTy) is null (forward declaration).
1242 #ifdef LLVM_TARGET_ENABLE_REGPARM 1243 // Allow the target to mark this as inreg. 1244 if (INTEGRAL_TYPE_P(ArgTy) || POINTER_TYPE_P(ArgTy) || 1245 SCALAR_FLOAT_TYPE_P(ArgTy)) 1246 LLVM_ADJUST_REGPARM_ATTRIBUTE(PAttributes, ArgTy, 1247 TREE_INT_CST_LOW(TYPE_SIZE(ArgTy)), 1248 local_regparam, local_fp_regparam); 1249 #endif // LLVM_TARGET_ENABLE_REGPARM
By the way, I forgot to mention that I ran into this when compiling real-world tested and working code (elinks browser). There I think the enum type was defined completely and it still crashed, but when I minimized it this is what I came up with, and adding an enum definition makes the crash go away. So I'm not entirely sure if it's this same bug or a different one, but it certainly seems sufficiently similar to suspect that they have a common cause.
See also bug 3730.
Extended Description
Create a file test.c with the line
void (*f)(enum b);
Run llvm-gcc -c test.c
llvm-gcc crashes:
$ llvm-gcc -c test.c test.c:1: warning: 'enum b' declared inside parameter list test.c:1: warning: its scope is only this definition or declaration, which is probably not what you want test.c:1: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://llvm.org/bugs/> for instructions.
I have llvm and llvm-gcc svn head from today. Architecture is i386.