Commit 28110f8
committed
Fix unspecified behaviour in zend_alloc in heap->limit computation
Right-shifting a negative number is unspecified (i.e.
implementation-defined) behaviour [1]. If we take a look at the
generated assembly [2], we see that the wrong value is computed.
Fix it by using Z_UL instead of Z_L.
While we're at it, just change every occurrence of this pattern to use
Z_UL instead of casting.
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf §6.5.7.5
[2] https://godbolt.org/z/4Y1qKKjsh
Closes GH-12613.1 parent a8c6c61 commit 28110f8
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1914 | 1914 | | |
1915 | 1915 | | |
1916 | 1916 | | |
1917 | | - | |
| 1917 | + | |
1918 | 1918 | | |
1919 | 1919 | | |
1920 | 1920 | | |
| |||
2859 | 2859 | | |
2860 | 2860 | | |
2861 | 2861 | | |
2862 | | - | |
| 2862 | + | |
2863 | 2863 | | |
2864 | 2864 | | |
2865 | 2865 | | |
| |||
3048 | 3048 | | |
3049 | 3049 | | |
3050 | 3050 | | |
3051 | | - | |
| 3051 | + | |
3052 | 3052 | | |
3053 | 3053 | | |
3054 | 3054 | | |
| |||
0 commit comments