Closed spraharsh closed 4 years ago
Hey spraharsh,
Thanks for the bug report. I did some debugging, and it looks like gcc is unhappy with Herbgrind allocating very big text buffers on the stack in certain cases. Not sure why your code would trigger this issue and others wouldn't, since it seems pretty straightforward, but I fixed the issue by allocating the output text buffers on the heap instead of the stack.
The reason that switching to std::cout prevented the segfault is because Herbgrind doesn't support std::cout as an output method, so it sees the program as not producing any output, and therefore doesn't produce an error report (errors are reported in terms of the program outputs they influence).
You should see the fix on both master
and develop
now, as well as your test case added to the bench/
dir as spraharsh-test.cpp
(if you would prefer I not include the test, or not mention you on it, I'm happy to change it).
Let me know if you have any further issues! Alex
I tried compiling the following c++ program as a test case.
and compiled it with
g++ ./sample.cpp -g -lm -O0 -o demo
I ran
./demo
giving me0.000000e+00
as expected,however, using herbgrind (I'm expanding the alias out)
gives me
my herbgrind installation seems okay since running the sample code provided in
diff-roots-simple.c
works and I get the expected outputIt might be an issue with the
printf
function since commenting out theprintf
and usingstd::cout
fixes it partly in the sense that herbgrind gives an output. howeverdemo.gh
, the output says no marks found, which I do not expect, considering the exact result is 1 when I get 0.