Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gmock.h:10090:60: runtime error: member call on null pointer of type 'const struct ResultHolder' #268

Closed
octoploid opened this issue Feb 3, 2016 · 3 comments

Comments

@octoploid
Copy link

Compiling with gcc-6 leads to segfault in the testsuite:

markus@x4 build % make test
Running tests...
Test project /var/tmp/cppformat/build
Start 1: assert-test
1/8 Test #1: assert-test ...................... Passed 0.01 sec
Start 2: gtest-extra-test
2/8 Test #2: gtest-extra-test ................. Passed 0.01 sec
Start 3: format-test
3/8 Test #3: format-test ......................_Exception: SegFault 0.00 sec
Start 4: format-impl-test
4/8 Test #4: format-impl-test ................. Passed 0.00 sec
Start 5: printf-test
5/8 Test #5: printf-test ...................... Passed 0.01 sec
Start 6: util-test
6/8 Test #6: util-test ........................
_Exception: SegFault 0.01 sec
Start 7: posix-mock-test
7/8 Test #7: posix-mock-test ..................***Exception: SegFault 0.01 sec
Start 8: posix-test
8/8 Test #8: posix-test ....................... Passed 0.01 sec

63% tests passed, 3 tests failed out of 8

This happens because undefined behavior is invoked:

markus@x4 bin % ./util-test
[==========] Running 35 tests from 6 test cases.
[----------] Global test environment set-up.
[----------] 1 test from AllocatorTest
[ RUN ] AllocatorTest.AllocatorRef
/var/tmp/cppformat/test/../gmock/gmock/gmock.h:10090:60: runtime error: member call on null pointer of type 'const struct ResultHolder'
[1] 15511 segmentation fault ./util-test

@octoploid
Copy link
Author

I've opened an upstream issue:
google/googletest#705

vitaut added a commit that referenced this issue Feb 4, 2016
@vitaut
Copy link
Contributor

vitaut commented Feb 4, 2016

Thanks for reporting. I've added -fno-delete-null-pointer-checks to tests as a workaround, but I don't have gcc-6 at hand. Could you by any chance check if it solves the issue?

@octoploid
Copy link
Author

Could you by any chance check if it solves the issue?

Yes, indeed -fno-delete-null-pointer-checks fixes the issue.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants