Bugfix for PointerObservations transformer

Moderator: Applied Static Analysis

bhermann
Moderator
Moderator
Beiträge: 15
Registriert: 17. Aug 2012 19:51

Bugfix for PointerObservations transformer

Beitrag von bhermann » 24. Mai 2016 13:07

Thanks to Patrick Müller we have a bugfix for my faulty implementation of PointerObservations.cpp.

Here is my buggy line:

Code: Alles auswählen

Constant* strVal = ConstantExpr::getGetElementPtr(Type::getInt8PtrTy(ctx), GVStr, indices, true);
And here is Patrick's fixed version:

Code: Alles auswählen

Constant* strVal = ConstantExpr::getGetElementPtr(0, GVStr, indices, true);
He is cleverly using an implementation detail of the called function:

Code: Alles auswählen

if (!Ty)
  Ty = cast<PointerType>(C->getType()->getScalarType())->getElementType();

Zurück zu „Applied Static Analysis“