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

segfault on assert fail with -O1 #46

Closed
cybojanek opened this issue Sep 18, 2015 · 6 comments
Closed

segfault on assert fail with -O1 #46

cybojanek opened this issue Sep 18, 2015 · 6 comments

Comments

@cybojanek
Copy link

When compiling test cases with anything other than -O0, a failed assert causes a program crash, instead of just a failure. Simple example:

#include <criterion/criterion.h>

Test(cat, meow)
{
    cr_assert_eq(strlen("meow"), 5);
}
gcc -O0 test.c -o test -lcriterion
# OK
./test
gcc -O1 test.c -o test -lcriterion
# Segfault
./test
@Snaipe
Copy link
Owner

Snaipe commented Sep 18, 2015

What operating system are you compiling the tests on ?
Also, is this happening with the stable release (a0af6a0), or the current bleeding branch ?

@cybojanek
Copy link
Author

9836678
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

@Snaipe
Copy link
Owner

Snaipe commented Sep 18, 2015

Does the commit f8e2054 happen to fix this ?

@cybojanek
Copy link
Author

I did a git checkout to that commit and it works (I wasn't able to cherry pick f8e2054 onto 9836678 because it depends on a bunch of other stuff).

Thanks!

@Snaipe
Copy link
Owner

Snaipe commented Sep 18, 2015

Ok, leaving this open for the moment as a reminder; it should be fixed when I merge the parameterized tests into bleeding.

Snaipe added a commit that referenced this issue Sep 19, 2015
@Snaipe
Copy link
Owner

Snaipe commented Sep 19, 2015

The bug seems to have been there for a long time -- this is why I'm merging the fix now on both master and bleeding. v2.0.1 is now the recommended stable version.

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

No branches or pull requests

2 participants