This is a PHP 7 compatibilty macro which was segfaulting due to the temporary variable being defined in the do..while scoped block (to swallow semicolon for macros), e.g: zval *arr; VIRT_ARRAY_INIT(arr); VIRT_ADD_ASSOC_STRING(arr, "foo", "bar"); // <= segfault here The VIRT_ARRAY_INIT above was expanding to: do { zval z_arr; // <= local scope definition arr = &z_arr; array_init(arr); } while (0) After this patch, the macro expands to: zval z_arr; // now defined in the scope of the macro caller do { arr = &z_arr; array_init(arr); } while (0) which solved the issue. --- src/util.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util.h b/src/util.h index 3af77d4..c96fd0c 100644 --- a/src/util.h +++ b/src/util.h @@ -151,10 +151,11 @@ } \ } while(0) -# define VIRT_ARRAY_INIT(_name) do { \ +# define VIRT_ARRAY_INIT(_name) \ zval z##_name; \ - _name = &z##_name; \ - array_init(_name); \ + do { \ + _name = &z##_name; \ + array_init(_name); \ } while(0) # else /* PHP_MAJOR_VERSION < 7 */ -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list