1/*******************************************************************\
5Author: Daniel Kroening, dkr@amazon.com
7\*******************************************************************/
22 // C99; ISO/IEC 9899:1999 6.5/7
26 return true;
// char * can alias anyting
28 return true;
// char * can alias anyting
33 // signed/unsigned of same width can alias
37 return true;
// void * can alias any pointer
39 return true;
// void * can alias any pointer
42 return true;
// void * can alias any pointer
45 return true;
// void * can alias any pointer
50 return true;
// void * can alias any pointer
55 return true;
// void * can alias any pointer
106// Is 'expr' on the stack and it's address is not taken?
109 const std::unordered_set<symbol_exprt, irep_hash> &
address_taken,
115 auto symbol_expr =
object->object_expr();
116 auto identifier = symbol_expr.identifier();
117 if(identifier.starts_with(
"va_arg::"))
118 return true;
// on the stack, and might alias
119 else if(identifier.starts_with(
"var_args::"))
120 return false;
// on the stack -- can take address?
121 else if(identifier.starts_with(
"va_args::"))
122 return false;
// on the stack -- can take address?
123 else if(identifier.starts_with(
"va_arg_array::"))
124 return false;
// on the stack -- can take address?
125 else if(identifier.starts_with(
"old::"))
126 return true;
// on the stack, but can't take address
127 else if(identifier ==
"return_value")
128 return true;
// on the stack, but can't take address
129 const auto &symbol = ns.
lookup(symbol_expr);
130 return !symbol.is_static_lifetime &&
153 // syntactically the same?
157 // a and b are both object/field/element?
196 // structs can't alias unless one is a prefix of the other
224 const std::unordered_set<symbol_exprt, irep_hash> &
address_taken,
233 // syntactically the same?
237 // consider the strict aliasing rule
243 // The object is known to be different, because of strict aliasing.
247 // a and b the same addresses?
252 // is one of them stack-allocated and it's address is not taken?
std::unordered_set< symbol_exprt, irep_hash > address_taken(const std::vector< exprt > &src)
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
signedbv_typet signed_char_type()
unsignedbv_typet unsigned_char_type()
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Boolean AND All operands must be boolean, and the result is always boolean.
Base class for all expressions.
The Boolean constant false.
const irep_idt & id() const
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
The Boolean constant true.
The type of an expression, extends irept.
std::optional< exprt > same_address(const exprt &a, const exprt &b, const namespacet &ns)
static std::optional< object_address_exprt > find_object(const exprt &expr)
bool permitted_by_strict_aliasing(const typet &a, const typet &b)
bool prefix_of(const typet &a, const typet &b, const namespacet &ns)
std::optional< exprt > may_alias(const exprt &a, const exprt &b, const std::unordered_set< symbol_exprt, irep_hash > &address_taken, const namespacet &ns)
static exprt drop_pointer_typecasts(exprt src)
bool is_object_field_element(const exprt &expr)
bool stack_and_not_dirty(const exprt &expr, const std::unordered_set< symbol_exprt, irep_hash > &address_taken, const namespacet &ns)
API to expression classes for Pointers.
const element_address_exprt & to_element_address_expr(const exprt &expr)
Cast an exprt to an element_address_exprt.
const object_address_exprt & to_object_address_expr(const exprt &expr)
Cast an exprt to an object_address_exprt.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const field_address_exprt & to_field_address_expr(const exprt &expr)
Cast an exprt to an field_address_exprt.
#define CHECK_RETURN(CONDITION)
#define PRECONDITION(CONDITION)
API to expression classes.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.