[llvm-bugs] [Bug 41775] New: SymbolTableSection::addSymbol - shadow variable names
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 6 11:46:56 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41775
Bug ID: 41775
Summary: SymbolTableSection::addSymbol - shadow variable names
Product: tools
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: llvm-objcopy/strip
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: alexander.v.shaposhnikov at gmail.com,
jake.h.ehrlich at gmail.com,
jh7370.2008 at my.bristol.ac.uk,
llvm-bugs at lists.llvm.org, phosek at chromium.org,
rupprecht at google.com
Blocks: 41655
void SymbolTableSection::addSymbol(Twine Name, uint8_t Bind, uint8_t Type,
SectionBase *DefinedIn, uint64_t Value,
uint8_t Visibility, uint16_t Shndx,
uint64_t Size) {
Symbol Sym;
Sym.Name = Name.str();
Sym.Binding = Bind;
Sym.Type = Type;
Sym.DefinedIn = DefinedIn;
if (DefinedIn != nullptr)
DefinedIn->HasSymbol = true;
if (DefinedIn == nullptr) {
if (Shndx >= SHN_LORESERVE)
Sym.ShndxType = static_cast<SymbolShndxType>(Shndx);
else
Sym.ShndxType = SYMBOL_SIMPLE_INDEX;
}
Sym.Value = Value;
Sym.Visibility = Visibility;
Sym.Size = Size;
Sym.Index = Symbols.size();
Symbols.emplace_back(llvm::make_unique<Symbol>(Sym));
Size += this->EntrySize;
}
The final line "Size += this->EntrySize" is updating the passed in function
argument (which is then thrown away).
Should this have been "this->Size += this->EntrySize" instead? If not the line
it superfluous and should be deleted.
Reported in https://www.viva64.com/en/b/0629/ (Snippet No. 37).
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=41655
[Bug 41655] Finding Bugs in LLVM 8 with PVS-Studio
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190506/dcc29ff7/attachment.html>
More information about the llvm-bugs
mailing list