Skip to content

Commit 7e87db1

Browse files
petr-bauchThomas Kiley
authored andcommitted
Fix over-writing library prologue
when linking the cprover library. The default mode for this constructor of stringstream is to over-write the string used in construction, which presumably was not the intention here. Note: until now there wasn't anything too interesting in the prologue except for the string-abstraction define, which was ignored. But we might want more defines in the future.
1 parent 641a14e commit 7e87db1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ansi-c/cprover_library.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ std::string get_cprover_library_text(
4545
const struct cprover_library_entryt cprover_library[],
4646
const std::string &prologue)
4747
{
48-
std::ostringstream library_text(prologue);
48+
// the default mode is ios_base::out which means subsequent write to the
49+
// stream will overwrite the original content
50+
std::ostringstream library_text(prologue, std::ios_base::ate);
4951

5052
std::size_t count=0;
5153

0 commit comments

Comments
 (0)