With an empty object module - or an object module without a `class Object' definition, a segfault occurs when attempting to use anything that requires TypeInfo. --- module object; extern(C) int main() { int[int] aa; aa[0] = 1; return 0; }
ice.d:4:7: internal compiler error: Segmentation fault 4 | aa[0] = 1; | ^ 0xe958af crash_signal ../../gcc/toplev.c:327 0x88d8b8 TypeInfoDeclaration::TypeInfoDeclaration(Type*) ../../gcc/d/dmd/declaration.c:1258 0x88ddb8 TypeInfoAssociativeArrayDeclaration::TypeInfoAssociativeArrayDeclaration(Type*) ../../gcc/d/dmd/declaration.c:1461 0x88de11 TypeInfoAssociativeArrayDeclaration::create(Type*) ../../gcc/d/dmd/declaration.c:1472 0x9de4f5 create_typeinfo(Type*, Module*) ../../gcc/d/typeinfo.cc:1559 0x9de8fa build_typeinfo(Loc const&, Type*) ../../gcc/d/typeinfo.cc:1394 0x9cd628 ExprVisitor::visit(IndexExp*) ../../gcc/d/expr.cc:1266 0x9c9ae0 build_expr(Expression*, bool, bool) ../../gcc/d/expr.cc:3129 0x9cdedc ExprVisitor::visit(AssignExp*) ../../gcc/d/expr.cc:1218 0x9c9ae0 build_expr(Expression*, bool, bool) ../../gcc/d/expr.cc:3129 0x9ca54c ExprVisitor::visit(CommaExp*) ../../gcc/d/expr.cc:1330 0x9c9ae0 build_expr(Expression*, bool, bool) ../../gcc/d/expr.cc:3129 0x9c9b8b build_expr_dtor(Expression*) ../../gcc/d/expr.cc:3152 0x9d8101 IRVisitor::visit(ExpStatement*) ../../gcc/d/toir.cc:1092 0x9d7c1f IRVisitor::build_stmt(Statement*) ../../gcc/d/toir.cc:274 0x9d7c1f IRVisitor::visit(CompoundStatement*) ../../gcc/d/toir.cc:1109 0x9d7c1f IRVisitor::visit(CompoundStatement*) ../../gcc/d/toir.cc:1099 0x9d7c1f IRVisitor::build_stmt(Statement*) ../../gcc/d/toir.cc:274 0x9d7c1f IRVisitor::visit(CompoundStatement*) ../../gcc/d/toir.cc:1109 0x9d7c1f IRVisitor::visit(CompoundStatement*) ../../gcc/d/toir.cc:1099 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:5ae4a73057dd26e7f09b5ba5190b84b1bbea4368 commit r12-1369-g5ae4a73057dd26e7f09b5ba5190b84b1bbea4368 Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Thu Jun 10 19:59:23 2021 +0200 d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967) Generate a stub TypeInfo class even if the root Object class is missing. The front-end will take care of issuing an error and abort the compilation when running semantic on constructed TypeInfo objects. The errors issued by the code generation pass relating to missing or disabled RTTI has been consolidated into a single function, so that a meaningful error will be emitted before the front-end terminates. gcc/d/ChangeLog: PR d/100967 * d-frontend.cc (getTypeInfoType): Move TypeInfo checks to check_typeinfo_type and call new function. * d-tree.h (check_typeinfo_type): Declare. * typeinfo.cc: Include dmd/scope.h. (create_frontend_tinfo_types): Generate front-end types even if Object is missing. (build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call new function. (check_typeinfo_type): New function. gcc/testsuite/ChangeLog: PR d/100967 * gdc.dg/pr100967.d: New test.
The releases/gcc-11 branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:228bcaca4286196d33741256dcd54b60e58b2b2f commit r11-8539-g228bcaca4286196d33741256dcd54b60e58b2b2f Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Thu Jun 10 19:59:23 2021 +0200 d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967) Generate a stub TypeInfo class even if the root Object class is missing. The front-end will take care of issuing an error and abort the compilation when running semantic on constructed TypeInfo objects. The errors issued by the code generation pass relating to missing or disabled RTTI has been consolidated into a single function, so that a meaningful error will be emitted before the front-end terminates. gcc/d/ChangeLog: PR d/100967 * d-frontend.cc (getTypeInfoType): Move TypeInfo checks to check_typeinfo_type and call new function. * d-tree.h (check_typeinfo_type): Declare. * typeinfo.cc: Include dmd/scope.h. (create_frontend_tinfo_types): Generate front-end types even if Object is missing. (build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call new function. (check_typeinfo_type): New function. gcc/testsuite/ChangeLog: PR d/100967 * gdc.dg/pr100967.d: New test. (cherry picked from commit 5ae4a73057dd26e7f09b5ba5190b84b1bbea4368)
The releases/gcc-10 branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:06b794846f1d8fa55133a257f6d7af39398b9cdc commit r10-9901-g06b794846f1d8fa55133a257f6d7af39398b9cdc Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Thu Jun 10 19:59:23 2021 +0200 d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967) Generate a stub TypeInfo class even if the root Object class is missing. The front-end will take care of issuing an error and abort the compilation when running semantic on constructed TypeInfo objects. The errors issued by the code generation pass relating to missing or disabled RTTI has been consolidated into a single function, so that a meaningful error will be emitted before the front-end terminates. gcc/d/ChangeLog: PR d/100967 * d-frontend.cc (getTypeInfoType): Move TypeInfo checks to check_typeinfo_type and call new function. * d-tree.h (check_typeinfo_type): Declare. * typeinfo.cc: Include dmd/scope.h. (create_frontend_tinfo_types): Generate front-end types even if Object is missing. (build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call new function. (check_typeinfo_type): New function. gcc/testsuite/ChangeLog: PR d/100967 * gdc.dg/pr100967.d: New test. (cherry picked from commit 5ae4a73057dd26e7f09b5ba5190b84b1bbea4368)
The releases/gcc-9 branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:3cf5b2930c22497617a535802b0c55248d688069 commit r9-9579-g3cf5b2930c22497617a535802b0c55248d688069 Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Thu Jun 10 19:59:23 2021 +0200 d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967) Generate a stub TypeInfo class even if the root Object class is missing. The front-end will take care of issuing an error and abort the compilation when running semantic on constructed TypeInfo objects. The errors issued by the code generation pass relating to missing or disabled RTTI has been consolidated into a single function, so that a meaningful error will be emitted before the front-end terminates. gcc/d/ChangeLog: PR d/100967 * d-frontend.cc (getTypeInfoType): Move TypeInfo checks to check_typeinfo_type and call new function. * d-tree.h (check_typeinfo_type): Declare. * typeinfo.cc: Include dmd/scope.h. (create_frontend_tinfo_types): Generate front-end types even if Object is missing. (build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call new function. (check_typeinfo_type): New function. gcc/testsuite/ChangeLog: PR d/100967 * gdc.dg/pr100967.d: New test. (cherry picked from commit 5ae4a73057dd26e7f09b5ba5190b84b1bbea4368)
Fix committed and backported.