diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-10 13:49:40 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-10 13:51:09 +0100 |
commit | d6f86caa11f3dcc3ec4c950ae34e01aa8fe726b0 (patch) | |
tree | 82845af0aabcb6c6db24ef55b215c9905f02c017 | |
parent | 9e22c3d4d976fb0a7298f32dd5e82d8a506116b5 (diff) | |
download | php-git-d6f86caa11f3dcc3ec4c950ae34e01aa8fe726b0.tar.gz |
Fix release build failure
GCC complained about potentially uninitialized __orig_bailout,
even though the variable has an initializer. This warning was
quite persistent, I was only able to avoid it by using a separate
function.
Am I missing something?
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 22 | ||||
-rw-r--r-- | ext/opcache/tests/preload_004.phpt | 2 | ||||
-rw-r--r-- | ext/opcache/tests/preload_loadable_classes_2.phpt | 2 |
3 files changed, 12 insertions, 14 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index df8d3c7746..3f65123aed 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -3870,6 +3870,15 @@ static void preload_check_windows_restrictions(zend_class_entry *scope) { } #endif +static inline int preload_update_class_constants(zend_class_entry *ce) { + /* This is a separate function to work around what appears to be a bug in GCC + * maybe-uninitialized analysis. */ + zend_try { + return zend_update_class_constants(ce); + } zend_end_try(); + return FAILURE; +} + static zend_class_entry *preload_load_prop_type(zend_property_info *prop, zend_string *name) { zend_class_entry *ce; if (zend_string_equals_literal_ci(name, "self")) { @@ -3915,18 +3924,7 @@ static void preload_ensure_classes_loadable() { #endif if (!(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) { - int result = SUCCESS; - zend_try { - result = zend_update_class_constants(ce); - } zend_catch { - /* Provide some context for the generated error. */ - zend_error_noreturn(E_ERROR, - "Error generated while resolving initializers of class %s during preloading", - ZSTR_VAL(ce->name)); - } zend_end_try(); - if (result == FAILURE) { - /* Just present to be safe: We generally always throw some - * other fatal error as part of update_class_constants(). */ + if (preload_update_class_constants(ce) == FAILURE) { zend_error_noreturn(E_ERROR, "Failed to resolve initializers of class %s during preloading", ZSTR_VAL(ce->name)); diff --git a/ext/opcache/tests/preload_004.phpt b/ext/opcache/tests/preload_004.phpt index df92abdc28..7242d071cb 100644 --- a/ext/opcache/tests/preload_004.phpt +++ b/ext/opcache/tests/preload_004.phpt @@ -14,4 +14,4 @@ var_dump(class_exists('Foo')); --EXPECTF-- Fatal error: Undefined class constant 'self::DOES_NOT_EXIST' in Unknown on line 0 -Fatal error: Error generated while resolving initializers of class Foo during preloading in Unknown on line 0 +Fatal error: Failed to resolve initializers of class Foo during preloading in Unknown on line 0 diff --git a/ext/opcache/tests/preload_loadable_classes_2.phpt b/ext/opcache/tests/preload_loadable_classes_2.phpt index 4a5d2b8a66..fc3fb1dc40 100644 --- a/ext/opcache/tests/preload_loadable_classes_2.phpt +++ b/ext/opcache/tests/preload_loadable_classes_2.phpt @@ -14,4 +14,4 @@ Warning: Use of undefined constant UNDEF - assumed 'UNDEF' (this will throw an E Fatal error: Class 'Foo' not found in Unknown on line 0 -Fatal error: Error generated while resolving initializers of class Test during preloading in Unknown on line 0 +Fatal error: Failed to resolve initializers of class Test during preloading in Unknown on line 0 |