fix ASAN reports about mismatched emplace new/delete
* spot/misc/bitvect.cc, spot/misc/bitvect.hh, spot/tl/formula.cc, spot/tl/formula.hh: Here. * NEWS: Mention the bug.
This commit is contained in:
parent
933c4cde0c
commit
d89579321f
5 changed files with 32 additions and 17 deletions
|
|
@ -124,7 +124,7 @@ namespace spot
|
|||
}
|
||||
}
|
||||
|
||||
const fnode* fnode::unique(const fnode* f)
|
||||
const fnode* fnode::unique(fnode* f)
|
||||
{
|
||||
auto ires = m.uniq.emplace(f);
|
||||
if (!ires.second)
|
||||
|
|
@ -132,7 +132,8 @@ namespace spot
|
|||
//(*ires.first)->dump(std::cerr << "UNI: ") << '\n';
|
||||
for (auto c: *f)
|
||||
c->destroy();
|
||||
delete f;
|
||||
f->~fnode();
|
||||
::operator delete(f);
|
||||
return (*ires.first)->clone();
|
||||
}
|
||||
//f->dump(std::cerr << "INS: ") << '\n';
|
||||
|
|
@ -158,7 +159,8 @@ namespace spot
|
|||
for (auto c: *this)
|
||||
c->destroy();
|
||||
}
|
||||
delete this;
|
||||
this->~fnode();
|
||||
::operator delete(const_cast<fnode*>(this));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -615,9 +617,8 @@ namespace spot
|
|||
v.insert(v.begin(), tt());
|
||||
}
|
||||
|
||||
|
||||
auto mem = operator new(sizeof(fnode)
|
||||
+ (v.size() - 1)*sizeof(*children));
|
||||
auto mem = ::operator new(sizeof(fnode)
|
||||
+ (v.size() - 1)*sizeof(*children));
|
||||
return unique(new(mem) fnode(o, v.begin(), v.end()));
|
||||
}
|
||||
|
||||
|
|
@ -1029,7 +1030,7 @@ namespace spot
|
|||
SPOT_UNREACHABLE();
|
||||
}
|
||||
|
||||
auto mem = operator new(sizeof(fnode) + sizeof(*children));
|
||||
auto mem = ::operator new(sizeof(fnode) + sizeof(*children));
|
||||
return unique(new(mem) fnode(o, {first, second}));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement de
|
||||
// Copyright (C) 2015, 2016, 2017 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
//
|
||||
// This file is part of Spot, a model checking library.
|
||||
|
|
@ -484,7 +484,7 @@ namespace spot
|
|||
[[noreturn]] static void report_min_invalid_arg();
|
||||
[[noreturn]] static void report_max_invalid_arg();
|
||||
|
||||
static const fnode* unique(const fnode*);
|
||||
static const fnode* unique(fnode*);
|
||||
|
||||
// Destruction may only happen via destroy().
|
||||
~fnode() = default;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue