Skip to content

Commit 2cfa30c

Browse files
committed
Fix strange bug seen with '-O2', '--with-valgrind', and valgrind test
I'm guessing this is a bug seen when inlining and one function using assembly and the other not using assembly related to `zend_string_equal_content`? At lower optimization levels it passes. (Environment: gcc 9.3 on Linux) `make test TESTS='ext/spl/tests/Vector/aggregate.phpt -m --show-mem --show-diff` fails while compiling the variable in the foreach.
1 parent 38d30bf commit 2cfa30c

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

Zend/zend_string.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,7 @@ static zend_always_inline zend_string *zend_interned_string_ht_lookup_ex(zend_ul
148148

149149
static zend_always_inline zend_string *zend_interned_string_ht_lookup(zend_string *str, HashTable *interned_strings)
150150
{
151-
zend_ulong h = ZSTR_H(str);
152-
uint32_t nIndex;
153-
uint32_t idx;
154-
Bucket *p;
155-
156-
nIndex = h | interned_strings->nTableMask;
157-
idx = HT_HASH(interned_strings, nIndex);
158-
while (idx != HT_INVALID_IDX) {
159-
p = HT_HASH_TO_BUCKET(interned_strings, idx);
160-
if ((p->h == h) && zend_string_equal_content(p->key, str)) {
161-
return p->key;
162-
}
163-
idx = Z_NEXT(p->val);
164-
}
165-
166-
return NULL;
151+
return zend_interned_string_ht_lookup_ex(ZSTR_H(str), ZSTR_VAL(str), ZSTR_LEN(str), interned_strings);
167152
}
168153

169154
/* This function might be not thread safe at least because it would update the

0 commit comments

Comments
 (0)