Skip to content

Commit 9fcce5d

Browse files
author
Meghana Gupta
committed
[MERGE #5165 @meg-gupta] OS#17035883 : Generate object check for Symbol compare lowering Found by OSS Fuzz
Merge pull request #5165 from meg-gupta:fixsymcmp
2 parents 6ab8c30 + c809750 commit 9fcce5d

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

lib/Backend/Lower.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23128,8 +23128,8 @@ bool Lowerer::GenerateFastBooleanAndObjectEqLikely(IR::Instr * instr, IR::Opnd *
2312823128
}
2312923129
else if (src1->GetValueType().IsLikelySymbol() && src2->GetValueType().IsLikelySymbol())
2313023130
{
23131-
this->GenerateSymbolTest(src1->AsRegOpnd(), instr, labelHelper, nullptr, false);
23132-
this->GenerateSymbolTest(src2->AsRegOpnd(), instr, labelHelper, nullptr, false);
23131+
this->GenerateSymbolTest(src1->AsRegOpnd(), instr, labelHelper, nullptr, true);
23132+
this->GenerateSymbolTest(src2->AsRegOpnd(), instr, labelHelper, nullptr, true);
2313323133
}
2313423134
else
2313523135
{

test/Bugs/rlexe.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,9 @@
467467
<compile-flags>-off:ArrayMissingValueCheckHoist</compile-flags>
468468
</default>
469469
</test>
470+
<test>
471+
<default>
472+
<files>symcmpbug.js</files>
473+
</default>
474+
</test>
470475
</regress-exe>

test/Bugs/symcmpbug.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function symcmp(c1, c2) {
7+
return (c1 !== c2);
8+
}
9+
10+
var s = Symbol();
11+
symcmp(s, s);
12+
symcmp(s, s);
13+
symcmp(1, 2);
14+
print("Passed");

0 commit comments

Comments
 (0)