[LLVMdev] Undefined behavior in Operator class?

Caldarale, Charles R Chuck.Caldarale at unisys.com
Sun Oct 7 10:14:39 PDT 2012

> From: Sean Silva [mailto:silvas at purdue.edu] 
> Subject: Re: [LLVMdev] Undefined behavior in Operator class?

> It doesn't fix the core problem though, which is that Instruction 
> and ConstantExpr are getting cast<>'d to Operator (or one of its 
> subclasses), in an illegal fashion.

This appears to be completely avoidable in nearly all of the situations, since the result of the dyn_cast<>() is used primarily to invoke the getOpcode() method.  In a few places, it's used to call a method in the User class.  Perhaps the dyn_cast to Operator could be replaced by one to User, avoiding any usage of an instance of Operator.

 - Chuck

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

More information about the llvm-dev mailing list