On 9 May 2012 19:36, Andreas Färber <afaer...@suse.de> wrote: > Thanks. Needs a respin though: Peter has noticed that cpu_init() does a > NULL pointer deference when cpu_xxx_init() returns NULL. I'm rewriting > as static inline function.
Well, strictly cpu_init() doesn't dereference NULL, because of the address-of operator: instead it just effectively returns offsetof(LM32CPU, env). This (being non-zero) doesn't trigger the caller's "did that fail?" check, and we get a segfault when the caller later tries to use it as a real pointer. -- PMM