Skip to content
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

OS#13255723, OS#13255732, OS#13255734, OS#13255735, OS#13255737: A few more uninitialized locals. #3646

Merged
merged 1 commit into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7507,7 +7507,11 @@ GlobOpt::TypeSpecializeInlineBuiltInBinary(IR::Instr **pInstr, Value *src1Val, V
if(src1Val->GetValueInfo()->IsLikelyInt() && src2Val->GetValueInfo()->IsLikelyInt())
{
// Compute resulting range info
int32 min1, max1, min2, max2, newMin, newMax;
int32 min1 = INT32_MIN;
int32 max1 = INT32_MAX;
int32 min2 = INT32_MIN;
int32 max2 = INT32_MAX;
int32 newMin, newMax;

Assert(this->DoAggressiveIntTypeSpec());
src1Val->GetValueInfo()->GetIntValMinMax(&min1, &max1, this->DoAggressiveIntTypeSpec());
Expand Down
6 changes: 3 additions & 3 deletions lib/Backend/IntBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void IntBounds::SetBound(

// Aggressively merge the constant lower or upper bound of the base value, adjusted by the offset
ValueInfo const * const baseValueInfo = baseValue->GetValueInfo();
int constantBoundBase;
int constantBoundBase = 0xCCCCCCCC;
Copy link
Collaborator

Choose a reason for hiding this comment

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

0xCCCCCCCC [](start = 28, length = 10)

Why these value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I couldn't find a default that made sense for these. 0 is often a bad choice, MIN/MAX_INT were not great.

0xCCCCCCCC has a few good properties:
o Negative
o Bad pointer
o INT 3 on x86/x64
o Easy to spot in the debugger
o That's what VC uses to initialize the stack with -RTC1

const bool success =
Lower
? baseValueInfo->TryGetIntConstantLowerBound(&constantBoundBase, true)
Expand Down Expand Up @@ -342,7 +342,7 @@ bool IntBounds::IsGreaterThanOrEqualTo(const Value *const value, const int offse
Assert(value);

ValueInfo const * const valueInfo = value->GetValueInfo();
int constantBoundBase;
int constantBoundBase = INT32_MAX;
const bool success = valueInfo->TryGetIntConstantUpperBound(&constantBoundBase, true);
Assert(success);
if(IsGreaterThanOrEqualTo(constantBoundBase, offset))
Expand All @@ -360,7 +360,7 @@ bool IntBounds::IsLessThanOrEqualTo(const Value *const value, const int offset)
Assert(value);

ValueInfo const * const valueInfo = value->GetValueInfo();
int constantBoundBase;
int constantBoundBase = INT32_MIN;
const bool success = valueInfo->TryGetIntConstantLowerBound(&constantBoundBase, true);
Assert(success);
if(IsLessThanOrEqualTo(constantBoundBase, offset))
Expand Down
2 changes: 1 addition & 1 deletion lib/Backend/Sym.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ StackSym::GetIntConstValue() const
{
return Js::TaggedInt::ToInt32(var);
}
int32 value;
int32 value = 0xCCCCCCCC;
const bool isInt32 = Js::JavascriptNumber::TryGetInt32Value(Js::JavascriptNumber::GetValue(var), &value);
Assert(isInt32);
return value;
Expand Down
5 changes: 4 additions & 1 deletion lib/Backend/ValueInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,10 @@ ValueInfo::MergeLikelyIntValueInfo(JitArenaAllocator* alloc, Value *toDataVal, V

if(newValueType.IsInt())
{
int32 min1, max1, min2, max2;
int32 min1 = INT32_MIN;
int32 max1 = INT32_MAX;
int32 min2 = INT32_MIN;
int32 max2 = INT32_MAX;
toDataValueInfo->GetIntValMinMax(&min1, &max1, false);
fromDataValueInfo->GetIntValMinMax(&min2, &max2, false);
return ValueInfo::NewIntRangeValueInfo(alloc, min(min1, min2), max(max1, max2), wasNegativeZeroPreventedByBailout);
Expand Down