Skip to content

Commit

Permalink
Fix for uninitialized variable (#828)
Browse files Browse the repository at this point in the history
This was causing undefined behavior with the Nvidia NVhpc compiler
which eventually led to a segmentatio fault.
  • Loading branch information
heshpdx authored Sep 1, 2024
1 parent a00d0da commit 8f4ba40
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/log_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct TaskTimer
start(nullptr);
}
TaskTimer(unsigned level = 1) :
TaskTimer(get_stream(), level)
TaskTimer(get_stream(level), level)
{}
TaskTimer(const char* msg, MessageStream& stream, unsigned level = 1) :
level_(level),
Expand All @@ -75,7 +75,7 @@ struct TaskTimer
start(msg);
}
TaskTimer(const char* msg, unsigned level = 1):
TaskTimer(msg, get_stream(), level)
TaskTimer(msg, get_stream(level), level)
{}
~TaskTimer()
{
Expand Down Expand Up @@ -129,9 +129,9 @@ struct TaskTimer
stream_ << msg << "... " << std::flush;

}
MessageStream& get_stream() const
MessageStream& get_stream(unsigned level) const
{
switch (level_) {
switch (level) {
case 1:
return message_stream;
case 2:
Expand Down

0 comments on commit 8f4ba40

Please sign in to comment.