Replace chkptr() with alloc() in generated code