Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: HHVM triggers an optimization bug in GCC 4.9 which leads to an incorrect refcounting issue when compiled with -O1 or greater. Add a testcase from fredemmott for the bug and add a warning in CMake about the compiler version. See: #8011 Signed-off-by: Arthur Loiret <arthur.loiret@adeline.mobi> Closes #8086 Differential Revision: D6642219 Pulled By: fredemmott fbshipit-source-id: 34e7ed588aa308c9cc10b445c4056250506bd9b0
- Loading branch information
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
// https://github.com/facebook/hhvm/issues/8011 | ||
|
||
class Test | ||
{ | ||
public function foo() | ||
{ | ||
$x = ['foo', 'bar']; | ||
// The actual operation isn't important, just need to do something to turn the literal | ||
// strings into refcounted strings | ||
$y = array_map(function($it) { return $it.$it; }, $x); | ||
return array_unique($y, SORT_STRING); | ||
} | ||
} | ||
|
||
var_dump((new Test())->foo()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
array(2) { | ||
[0]=> | ||
string(6) "foofoo" | ||
[1]=> | ||
string(6) "barbar" | ||
} |