Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SMPStaticAnalyzer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
SMPStaticAnalyzer
Commits
b5e16616
Commit
b5e16616
authored
11 years ago
by
clc5q
Browse files
Options
Downloads
Patches
Plain Diff
Add SINKMALLOC tag to TRUNCATIONs.
parent
128b49cc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SMPInstr.cpp
+26
-7
26 additions, 7 deletions
SMPInstr.cpp
with
26 additions
and
7 deletions
SMPInstr.cpp
+
26
−
7
View file @
b5e16616
...
@@ -7982,6 +7982,7 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
...
@@ -7982,6 +7982,7 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
// of an int or a pointer. Cannot have signedness error in that case, as sign bit
// of an int or a pointer. Cannot have signedness error in that case, as sign bit
// is not affected.
// is not affected.
char *disasm = DisAsmText.GetDisAsm(this->GetAddr());
char *disasm = DisAsmText.GetDisAsm(this->GetAddr());
string SinkString("");
if (this->IsNumericAnnotationSuppressed()) {
if (this->IsNumericAnnotationSuppressed()) {
return; // Cannot figure out IdiomCode; suppressed from earlier instruction's analyses
return; // Cannot figure out IdiomCode; suppressed from earlier instruction's analyses
...
@@ -8144,7 +8145,6 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
...
@@ -8144,7 +8145,6 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
this->MDGetUnnormalizedOp(AnnotDefOp);
this->MDGetUnnormalizedOp(AnnotDefOp);
}
}
AnnotPrintOperand(AnnotDefOp, InfoAnnotFile);
AnnotPrintOperand(AnnotDefOp, InfoAnnotFile);
string SinkString("");
if (!IgnoreOverflow) {
if (!IgnoreOverflow) {
// See if we made a special detection of an operation involved in a hash function, which can
// See if we made a special detection of an operation involved in a hash function, which can
// be expected to overflow benignly.
// be expected to overflow benignly.
...
@@ -8599,12 +8599,19 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
...
@@ -8599,12 +8599,19 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
// signedness errors are the result of the uncertainty, but all truncations are detected
// signedness errors are the result of the uncertainty, but all truncations are detected
// for all nine cases.
// for all nine cases.
bool HasSinkString = this->GetBlock()->GetFunc()->HasIntErrorCallSink(DestSearchOp, DefSSANum, this->address, SinkString);
if (DefIsUnsigned || UseIsUnsigned) {
if (DefIsUnsigned || UseIsUnsigned) {
// First five cases above: any UNSIGNED operand leads to CHECK TRUNCATION UNSIGNED annotation.
// First five cases above: any UNSIGNED operand leads to CHECK TRUNCATION UNSIGNED annotation.
if (!SuppressTruncation) {
if (!SuppressTruncation) {
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNSIGNED %zu %s %zu %s
ZZ %s \n
",
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNSIGNED %zu %s %zu %s",
this->address, this->SMPcmd.size, SourceDefBitWidth,
this->address, this->SMPcmd.size, SourceDefBitWidth,
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp), disasm);
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp));
if (HasSinkString) {
SMP_fprintf(InfoAnnotFile, " ZZ %s %s \n", SinkString.c_str(), disasm);
}
else {
SMP_fprintf(InfoAnnotFile, " ZZ %s \n", disasm);
}
#if SMP_MEASURE_NUMERIC_ANNOTATIONS
#if SMP_MEASURE_NUMERIC_ANNOTATIONS
++TruncationAnnotationsCount;
++TruncationAnnotationsCount;
#endif
#endif
...
@@ -8636,9 +8643,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
...
@@ -8636,9 +8643,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
else if (DefIsSigned && UseIsSigned) {
else if (DefIsSigned && UseIsSigned) {
// S => S case above. Emit CHECK TRUNCATION SIGNED annotation.
// S => S case above. Emit CHECK TRUNCATION SIGNED annotation.
if (!SuppressTruncation) {
if (!SuppressTruncation) {
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION SIGNED %zu %s %zu %s
ZZ %s \n
",
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION SIGNED %zu %s %zu %s",
this->address, this->SMPcmd.size, SourceDefBitWidth,
this->address, this->SMPcmd.size, SourceDefBitWidth,
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp), disasm);
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp));
if (HasSinkString) {
SMP_fprintf(InfoAnnotFile, " ZZ %s %s \n", SinkString.c_str(), disasm);
}
else {
SMP_fprintf(InfoAnnotFile, " ZZ %s \n", disasm);
}
#if SMP_MEASURE_NUMERIC_ANNOTATIONS
#if SMP_MEASURE_NUMERIC_ANNOTATIONS
++TruncationAnnotationsCount;
++TruncationAnnotationsCount;
#endif
#endif
...
@@ -8652,9 +8665,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
...
@@ -8652,9 +8665,15 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<size_t> &Lo
else {
else {
// S => ?, ? => S, ? => ? cases above: CHECK TRUNCATION UNKNOWNSIGN annotation.
// S => ?, ? => S, ? => ? cases above: CHECK TRUNCATION UNKNOWNSIGN annotation.
if (!SuppressTruncation) {
if (!SuppressTruncation) {
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNKNOWNSIGN %zu %s %zu %s
ZZ %s \n
",
SMP_fprintf(InfoAnnotFile, "%10x %6d INSTR CHECK TRUNCATION UNKNOWNSIGN %zu %s %zu %s",
this->address, this->SMPcmd.size, SourceDefBitWidth,
this->address, this->SMPcmd.size, SourceDefBitWidth,
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp), disasm);
MDGetRegName(SearchOp), UseBitWidth, MDGetRegName(UseOp));
if (HasSinkString) {
SMP_fprintf(InfoAnnotFile, " ZZ %s %s \n", SinkString.c_str(), disasm);
}
else {
SMP_fprintf(InfoAnnotFile, " ZZ %s \n", disasm);
}
#if SMP_MEASURE_NUMERIC_ANNOTATIONS
#if SMP_MEASURE_NUMERIC_ANNOTATIONS
++TruncationAnnotationsCount;
++TruncationAnnotationsCount;
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment