Skip to content

Workaraound against false positive GCC array bounds error #15078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Jul 23, 2024

This prevents compilation error when compiling PHP by GCC with "-O2 -g -Wall -Werror"

zend_API.c:2754:34: error: array subscript ‘zend_function {aka const union _zend_function}[0]’ is partly outside array bounds of ‘unsigned char[160]’ [-Werror=array-bounds=]

 2754 |         if (ZSTR_VAL(fptr->common.function_name)[0] != '_'

This is an alternative to #15013

Copy link
Contributor

@morrisonlevi morrisonlevi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Note that I think there really is an issue in the other GH issue, but this shorter, less complex PR at least removes the block for those building with --enable-werror.

This prevents compilation error when compiling PHP by GCC with "-O2 -g -Wall -Werror"

zend_API.c:2754:34: error: array subscript ‘zend_function
{aka const union _zend_function}[0]’ is partly outside array bounds of
‘unsigned char[160]’ [-Werror=array-bounds=]

 2754 |         if (ZSTR_VAL(fptr->common.function_name)[0] != '_'
@dstogov dstogov merged commit d41e97a into php:PHP-8.2 Jul 24, 2024
9 checks passed
dstogov added a commit that referenced this pull request Jul 24, 2024
* PHP-8.2:
  Workaraound against false positive GCC array bounds error (#15078)
dstogov added a commit that referenced this pull request Jul 24, 2024
* PHP-8.3:
  Workaraound against false positive GCC array bounds error (#15078)
deAtog pushed a commit to deAtog/php-src that referenced this pull request Jul 26, 2024
This prevents compilation error when compiling PHP by GCC with "-O2 -g -Wall -Werror"

zend_API.c:2754:34: error: array subscript ‘zend_function
{aka const union _zend_function}[0]’ is partly outside array bounds of
‘unsigned char[160]’ [-Werror=array-bounds=]

 2754 |         if (ZSTR_VAL(fptr->common.function_name)[0] != '_'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants