| 343 | } |
| 344 | |
| 345 | static expr eq_except_padding(const Memory &m, const Type &ty, const expr &e1, |
| 346 | const expr &e2, bool ptr_compare) { |
| 347 | if (ptr_compare && ty.isPtrType()) |
| 348 | return Pointer(m, e1) == Pointer(m, e2); |
| 349 | |
| 350 | const auto *aty = ty.getAsAggregateType(); |
| 351 | if (!aty) |
| 352 | return e1 == e2; |
| 353 | |
| 354 | StateValue sv1{expr(e1), expr()}; |
| 355 | StateValue sv2{expr(e2), expr()}; |
| 356 | expr result = true; |
| 357 | |
| 358 | for (unsigned i = 0; i < aty->numElementsConst(); ++i) { |
| 359 | if (aty->isPadding(i)) |
| 360 | continue; |
| 361 | |
| 362 | result &= eq_except_padding(m, aty->getChild(i), aty->extract(sv1, i).value, |
| 363 | aty->extract(sv2, i).value, ptr_compare); |
| 364 | } |
| 365 | return result; |
| 366 | } |
| 367 | |
| 368 | expr State::strip_undef_and_add_ub(const Value &val, const expr &e, |
| 369 | bool ptr_compare) { |
no test coverage detected