search for: nullptr

Displaying 20 results from an estimated 531 matches for "nullptr".

2016 Mar 23
4
UBSan, StringRef and Allocator.h
...lease CC more people as needed). I have an UBSan failure in BumpPtrAllocatorImpl.Allocate. The problem is that lld requests that we StringRef::copy an empty string. This passes a length of 0 to a BumpPtrAllocator. The BumpPtrAllocator happened to not have anything allocated yet so the CurPtr is nullptr, but given that we need 0 space we think we have enough space and return an allocation of size 0 at address nullptr. This therefore returns nullptr from Allocate, but that method is marked with LLVM_ATTRIBUTE_RETURNS_NONNULL and LLVM_ATTRIBUTE_RETURNS_NOALIAS, both of which aren’t true in this cas...
2016 Mar 23
3
UBSan, StringRef and Allocator.h
...as needed). > > I have an UBSan failure in BumpPtrAllocatorImpl.Allocate. > > The problem is that lld requests that we StringRef::copy an empty string. This passes a length of 0 to a BumpPtrAllocator. The BumpPtrAllocator happened to not have anything allocated yet so the CurPtr is nullptr, but given that we need 0 space we think we have enough space and return an allocation of size 0 at address nullptr. This therefore returns nullptr from Allocate, but that method is marked with LLVM_ATTRIBUTE_RETURNS_NONNULL and LLVM_ATTRIBUTE_RETURNS_NOALIAS, both of which aren’t true in this cas...
2016 Mar 23
0
UBSan, StringRef and Allocator.h
...ded). > > I have an UBSan failure in BumpPtrAllocatorImpl.Allocate. > > The problem is that lld requests that we StringRef::copy an empty string. > This passes a length of 0 to a BumpPtrAllocator. The BumpPtrAllocator > happened to not have anything allocated yet so the CurPtr is nullptr, but > given that we need 0 space we think we have enough space and return an > allocation of size 0 at address nullptr. This therefore returns nullptr > from Allocate, but that method is marked > with LLVM_ATTRIBUTE_RETURNS_NONNULL and LLVM_ATTRIBUTE_RETURNS_NOALIAS, > both of whic...
2014 Sep 25
5
[LLVMdev] New type of smart pointer for LLVM
...ould look like (see changes in TGParser::ParseDef(), TGParser::InstantiateMulticlassDef() and TGParser::ParseSimpleValue()). Briefly: consider a leaky example: { T* p = new T; if (condition1) { f(p); // takes ownership of p } p->SomeMethod(); if (condition2) { return nullptr; // Leak! } g(p); // don't take ownership of p return p; } The preferred solution would look like: { smart_ptr<T> p(new T); if (condition1) { f(p.StopOwn()); // takes ownership of p } p->SomeMethod(); if (condition2) { return nullptr; // } g(...
2016 Sep 25
8
Is it time to allow StringRef to be constructed from nullptr?
While porting LLDB over to StringRef, I am continuously running into difficulties caused by the fact that StringRef cannot be constructed from nullptr. So I wanted to see peoples' thoughts on removing this restriction from StringRef. To be clear, I'm only using LLDB as a motivating example, but I'm not requesting that it be done because LLDB is some kind of special case. If it is to be done it should be on its own merits. That sai...
2016 Jun 22
4
Help building llvm on freebsd 8.4
.../home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp: In member function 'llvm::tgtok::TokKind llvm::TGLexer::LexNumber()': /home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp:393:48: error: 'strtoll' was not declared in this scope CurIntVal = strtoll(NumStart, nullptr, 16); ^ /home/spangeni/llvm/llvm-3.8.0.src/lib/TableGen/TGLexer.cpp:398:60: error: 'strtoull' was not declared in this scope CurIntVal = (int64_t)strtoull(NumStart, nullptr, 16);...
2016 Mar 23
0
UBSan, StringRef and Allocator.h
...ded). > > I have an UBSan failure in BumpPtrAllocatorImpl.Allocate. > > The problem is that lld requests that we StringRef::copy an empty string. > This passes a length of 0 to a BumpPtrAllocator. The BumpPtrAllocator > happened to not have anything allocated yet so the CurPtr is nullptr, but > given that we need 0 space we think we have enough space and return an > allocation of size 0 at address nullptr. This therefore returns nullptr > from Allocate, but that method is marked with LLVM_ATTRIBUTE_RETURNS_NONNULL > and LLVM_ATTRIBUTE_RETURNS_NOALIAS, both of which are...
2018 Feb 06
2
6 separate instances of static getPointerOperand(). Time to consolidate?
...t>(&Inst)) return Load->getPointerOperand(); else if (StoreInst *Store = dyn_cast<StoreInst>(&Inst)) return Store->getPointerOperand(); else if (GetElementPtrInst *Gep = dyn_cast<GetElementPtrInst>(&Inst)) return Gep->getPointerOperand(); return nullptr; } ------------- Analysis/DependenceAnalysis.cpp static Value *getPointerOperand(Instruction *I) { if (LoadInst *LI = dyn_cast<LoadInst>(I)) return LI->getPointerOperand(); if (StoreInst *SI = dyn_cast<StoreInst>(I)) return SI->getPointerOperand(); llvm_unreachable...
2016 Mar 23
0
UBSan, StringRef and Allocator.h
...;> >> I have an UBSan failure in BumpPtrAllocatorImpl.Allocate. >> >> The problem is that lld requests that we StringRef::copy an empty string. This passes a length of 0 to a BumpPtrAllocator. The BumpPtrAllocator happened to not have anything allocated yet so the CurPtr is nullptr, but given that we need 0 space we think we have enough space and return an allocation of size 0 at address nullptr. This therefore returns nullptr from Allocate, but that method is marked with LLVM_ATTRIBUTE_RETURNS_NONNULL and LLVM_ATTRIBUTE_RETURNS_NOALIAS, both of which aren’t true in this cas...
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
...Transforms/Utils/BuildLibCalls.cpp (working copy) @@ -52,6 +52,28 @@ return CI; } +Value *llvm::emitStrNLen(Value *Ptr, Value *MaxLen, IRBuilder<> &B, + const DataLayout &DL, const TargetLibraryInfo *TLI) { + if (!TLI->has(LibFunc::strlen)) + return nullptr; + + Module *M = B.GetInsertBlock()->getModule(); + AttributeSet AS[2]; + AS[0] = AttributeSet::get(M->getContext(), 1, Attribute::NoCapture); + Attribute::AttrKind AVs[2] = { Attribute::ReadOnly, Attribute::NoUnwind }; + AS[1] = AttributeSet::get(M->getContext(), AttributeSet::Functi...
2017 Oct 07
2
Bug 20871 -- is there a fix or work around?
...0644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -1632,10 +1632,11 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM, if (!Subtarget.is64Bit()) { // These libcalls are not available in 32-bit. setLibcallName(RTLIB::SHL_I128, nullptr); setLibcallName(RTLIB::SRL_I128, nullptr); setLibcallName(RTLIB::SRA_I128, nullptr); + setLibcallName(RTLIB::MUL_I128, nullptr); } // Combine sin / cos into one node or libcall if possible. if (Subtarget.hasSinCos()) { setLibcallName(RTLIB::SINCOS_F32, "sincosf&quot...
2016 Mar 28
2
UBSan, StringRef and Allocator.h
...UBSan failure in BumpPtrAllocatorImpl.Allocate. >> >> The problem is that lld requests that we StringRef::copy an empty >> string. This passes a length of 0 to a BumpPtrAllocator. The >> BumpPtrAllocator happened to not have anything allocated yet so the CurPtr >> is nullptr, but given that we need 0 space we think we have enough space >> and return an allocation of size 0 at address nullptr. This therefore >> returns nullptr from Allocate, but that method is marked >> with LLVM_ATTRIBUTE_RETURNS_NONNULL and LLVM_ATTRIBUTE_RETURNS_NOALIAS, >> b...
2015 Sep 14
2
TableGen MCInstrDesc Instruction Size Zero
Dear all, I am trying to write an AsmParser and a CodeEmitter for simple ADD instruction. Here is what I have in the TestGenInstrInfo.td: *extern const MCInstrDesc TestInsts[] = {...{ 23, 3, 1, 0, 0, 0, 0x0ULL, nullptr, nullptr, OperandInfo13, 0, nullptr }, // Inst #23 = ADD8_rr...}* I parse the instruction successfully but I am not sure what I did wrong that the Size (as you can see in the line above is Zero for this instruction. (In EncodeInstruction, Desc.getSize() returns zero.) Any help is appreciated.......
2016 Jun 14
2
Calling a null pointer. How undefined it is?
...ne generated by LLVM for a coroutine. I stripped all coroutine related details to get to the essence of the question. Let's say I have a state machine that looks like this: struct State { FnPtr Fn; State() : Fn(&SomeFunction) {} void Go() { (*Fn)(); } void Stop() { Fn = nullptr; } bool IsDone() { return Fn == nullptr; } }; Fn field serves two purposes: * Cheap check for done. What can be better than compare with zero! * Guard against programmer mistake: accidentally calling Go() when in a Stopped state. Is it an appropriate use of undefined behavior? Thank you...
2015 Oct 08
5
ilist/iplist are broken (maybe I'll fix them?)
...C'ed the people in the IRC conversation and a couple of others that seem to care about ADT and/or UB. "Normal" intrusive lists ======================== First, here's a simple ("normal") intrusive doubly-linked list: struct ListNodeBase { ListNodeBase *next = nullptr; ListNodeBase *prev = nullptr; }; struct ListBase { struct iterator { ListNodeBase *I = nullptr; iterator &operator++() { I = I->next; return *this; } iterator &operator--() { I = I->prev; return *this; } ListNodeBase &operator*(...
2016 Sep 24
2
RFC: Implement variable-sized register classes
On 9/24/2016 7:20 AM, Alex Bradbury wrote: > My concern is that all of the above adds yet more complexity to what > is already (in my view) a fairly difficult part of LLVM to understand. > The definition of MyRegisterClass is not so bad though, and perhaps it > doesn't matter how it works under the hood to the average backend > writer. I agree with the complexity, but I would
2017 Oct 11
3
TargetRegistry and MC object ownership.
...bjects by calling registered ctor functions. E.g.: MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI, StringRef TheTriple, StringRef CPU, const MCTargetOptions &Options) const { if (!MCAsmBackendCtorFn) return nullptr; return MCAsmBackendCtorFn(*this, MRI, Triple(TheTriple), CPU, Options); } The callee owns the resulting object so ideally we would return a unique_ptr<MCAsmBackend>, but to do this we'd need access to the definition of MCAsmBackend which we can't get without violating layering. (W...
2018 Feb 06
0
6 separate instances of static getPointerOperand(). Time to consolidate?
...urn Load->getPointerOperand(); > else if (StoreInst *Store = dyn_cast<StoreInst>(&Inst)) > return Store->getPointerOperand(); > else if (GetElementPtrInst *Gep = dyn_cast<GetElementPtrInst>(&Inst)) > return Gep->getPointerOperand(); > return nullptr; > } > > ------------- Analysis/DependenceAnalysis.cpp > > static > Value *getPointerOperand(Instruction *I) { > if (LoadInst *LI = dyn_cast<LoadInst>(I)) > return LI->getPointerOperand(); > if (StoreInst *SI = dyn_cast<StoreInst>(I)) > retur...
2018 Aug 23
2
Sanitizers and static linking
...t. Yet the interceptors use dlsym to set up certain system calls, so by definition they can't support static linking. Given that sanitizers won't work with static linking, why are static libraries created for them? Should there be an error check in the interceptor code for dlsym returning nullptr? I just spent a bunch of time tracking down a problem that turned out to be dlsym returning nullptr due to static linking. It seems like either users should not be able to link sanitizer runtime when linking statically or there should be a runtime check that dlsym doesn't return nullptr. Ide...
2016 Mar 29
0
UBSan, StringRef and Allocator.h
...gt;> I have an UBSan failure in BumpPtrAllocatorImpl.Allocate. >>> >>> The problem is that lld requests that we StringRef::copy an empty string. This passes a length of 0 to a BumpPtrAllocator. The BumpPtrAllocator happened to not have anything allocated yet so the CurPtr is nullptr, but given that we need 0 space we think we have enough space and return an allocation of size 0 at address nullptr. This therefore returns nullptr from Allocate, but that method is marked with LLVM_ATTRIBUTE_RETURNS_NONNULL and LLVM_ATTRIBUTE_RETURNS_NOALIAS, both of which aren’t true in this cas...