A question about nonnull value of auto_ptr

陳韋任 (Wei-Ren Chen) chenwj.cs97g at nctu.edu.tw
Wed Nov 5 02:51:36 PST 2014


> > Front-end result shows the auto pointer is nonnull, i.e.
> > dereferenceable(8), and this is why llvm back-end can optimize the
> > comparison away, but the problem is can we really assume &*this->pc
> > is not 0? Why?
> > 
> > 
> > 
> > ; Function Attrs: nounwind uwtable
> > define i32 @_ZN1C1fEv(%class.C* %this) #2 align 2 {
> > entry:
> > %this.addr = alloca %class.C*, align 8
> > store %class.C* %this, %class.C** %this.addr, align 8
> > %this1 = load %class.C** %this.addr
> > %pc = getelementptr inbounds %class.C* %this1, i32 0, i32 0
> > %call = call dereferenceable(8) %class.C*
> > @_ZNKSt8auto_ptrIK1CEdeEv(%"class.std::auto_ptr"* %pc) #1
> > %cmp = icmp eq %class.C* %call, null
> > %conv = zext i1 %cmp to i32
> > ret i32 %conv
> > }
> > 
> > 
> > BTW, this issue triggered a run-time crash for one of SPEC
> > benchmarks.

  I am curious about what kind of code crash the SPEC benchmark.
Maybe the SPEC benchmark was modified to use C++1x by hand?

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Homepage: http://people.cs.nctu.edu.tw/~chenwj




More information about the cfe-commits mailing list