Compiling the following invalid objc testcase results in an ICE: ============================ void foo() { struct A a; a.i; } ============================
bug1.m: In function 'foo': bug1.m:3: error: storage size of 'a' isn't known bug1.m:4: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in objc_is_public, at objc/objc-act.c:7171 Please submit a full bug report, [etc.] The following patch fixes the problem for me, but hasn't been bootstrapped yet: =================================================================== --- gcc/gcc/objc/objc-act.c (revision 113130) +++ gcc/gcc/objc/objc-act.c (working copy) @@ -7168,6 +7168,9 @@ return 1; #endif + if (TREE_TYPE (expr) == error_mark_node) + return 1; + basetype = TYPE_MAIN_VARIANT (TREE_TYPE (expr)); if (basetype && TREE_CODE (basetype) == RECORD_TYPE) =================================================================== -- Summary: [4.1/4.2 regression] ICE with invalid fields Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, error-recovery Severity: normal Priority: P3 Component: objc AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27240