Skip to content

Fix bug #81096: Re-infer ranges if ref type is inferred #7114

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

Closed
wants to merge 2 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Jun 7, 2021

If a reference type for a variable is inferred, the range
information becomes potentially incorrect, as the variable may
be modified indirectly at any time.

If a reference type is inferred, set the variable to the full
range and recompute dependent ranges. This is done using a separate
range worklist that calculates ranges using a widening meet.

Fix for https://bugs.php.net/bug.php?id=81096.

If a reference type for a variable is inferred, the range
information becomes potentially incorrect, as the variable may
be modified indirectly at any time.

If a reference type is inferred, set the variable to the full
range and recompute dependent ranges. This is done using a separate
range worklist that calculates ranges using a widening meet.

Fix for https://bugs.php.net/bug.php?id=81096.
@dstogov
Copy link
Member

dstogov commented Jun 8, 2021

I think, it should be a better way to fix this. I'll try to take a look.

range_worklist = do_alloca(sizeof(zend_ulong) * zend_bitset_len(ssa_vars_count), use_heap);
memset(range_worklist, 0, sizeof(zend_ulong) * zend_bitset_len(ssa_vars_count));
range_worklist = worklist + worklist_len;
memset(range_worklist, 0, sizeof(zend_ulong) * worklist_len);
Copy link
Member

Choose a reason for hiding this comment

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

It seems that memset can also be combined too.

@nikic
Copy link
Member Author

nikic commented Jun 10, 2021

Fixed in different way by #7121.

@nikic nikic closed this Jun 10, 2021
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.

4 participants