After fixing bug 770484, this related bug was easily
spotted. SDCC tries to get the name of an array in a
struct which is not an AST_SYM_VALUE. This generates
an access violation / SIGSEGV. This patch validates the
pointers before dereferencing them, solving the crash.
It does not however fully solve the issue. While
generating initialization code for the first array, it's
length is determined and stored in the type. When it
generates initialization code for a next instance it no
longer is of unspecified length. And if the latter is
longer, SDCC still warns about too many initializers and
truncates the initialization. A work-around is to define
the largest struct (with the largest array) first.
Log in to post a comment.