http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47922
Summary: [4.6 Regression] libobjc crashes with garbage collection in any real-life program Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: libobjc AssignedTo: unassig...@gcc.gnu.org ReportedBy: nic...@gcc.gnu.org >From Richard Frith-Macdonald (r...@gnu.org) -- > I enabled gc and built base using the new compiler runtime, but as soon as > I start any program, it segfaults. > > It appears that a bug has crept in to the libobjc type encoding handling, > so when you call class_ivar_set_gcinvisible() for any class, you get a crash. > > The crash is a divide by zero in objc_layout_structure_next_member() > (at line 1278 desired_align is zero). > > I think the problem is that the exclamation mark denoting a weak variable > is not being handled in the function. > On line 1208 objc_skip_type_qualifiers() is not skipping past it, then > on line 1211 objc_alignof_type() is returning zero. > > Looking at the ChangeLog, I think you broke this on 2010-09-26 changing > _C_GCINVISIBLE from '!' to '|' when parts of the code use a literal > exclamation mark rather than the symbolic constant. > > Is it too late to get this fixed? gc.c line 427 replace three lines with: new_type[len++] = _C_GCINVISIBLE; strcpy (new_type + len, type);