-
Notifications
You must be signed in to change notification settings - Fork 273
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
Test to demonstate assert bug on alpine #726
Conversation
The user added assert in this test does not get coverage under alpine linux.
This is also failing on Windows... |
Could anyone post the pre-processing result obtained on Alpine Linux? |
Sure, one moment. A quick discussion with @martin-cs suggested that replace |
Here is the output for doing the following: test.c #include <assert.h>
int main()
{
int x=0;
assert(x>0);
} Command on Alpine $ gcc -E test.c -o test_output.c test_output.c # 1 "test_new.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "test_new.c"
# 1 "/usr/include/assert.h" 1 3 4
# 1 "/usr/include/features.h" 1 3 4
# 2 "/usr/include/assert.h" 2 3 4
# 19 "/usr/include/assert.h" 3 4
# 19 "/usr/include/assert.h" 3 4
_Noreturn void __assert_fail (const char *, const char *, int, const char *);
# 2 "test_new.c" 2
# 3 "test_new.c"
int main()
{
int x=0;
# 6 "test_new.c" 3 4
((void)((
# 6 "test_new.c"
x>0
# 6 "test_new.c" 3 4
) || (__assert_fail(
# 6 "test_new.c"
"x>0"
# 6 "test_new.c" 3 4
, "test_new.c", 6, __func__),0)))
# 6 "test_new.c"
;
} Repeating on Ubuntu 16.04 gives: ubunut_test_output.c # 1 "test_new.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "test_new.c"
# 1 "/usr/include/assert.h" 1 3 4
# 35 "/usr/include/assert.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 367 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 1 3 4
# 410 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/wordsize.h" 1 3 4
# 411 "/usr/include/x86_64-linux-gnu/sys/cdefs.h" 2 3 4
# 368 "/usr/include/features.h" 2 3 4
# 391 "/usr/include/features.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 1 3 4
# 10 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/gnu/stubs-64.h" 1 3 4
# 11 "/usr/include/x86_64-linux-gnu/gnu/stubs.h" 2 3 4
# 392 "/usr/include/features.h" 2 3 4
# 36 "/usr/include/assert.h" 2 3 4
# 66 "/usr/include/assert.h" 3 4
# 69 "/usr/include/assert.h" 3 4
extern void __assert_fail (const char *__assertion, const char *__file,
unsigned int __line, const char *__function)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
extern void __assert_perror_fail (int __errnum, const char *__file,
unsigned int __line, const char *__function)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
extern void __assert (const char *__assertion, const char *__file, int __line)
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
# 2 "test_new.c" 2
# 3 "test_new.c"
int main()
{
int x=0;
# 6 "test_new.c" 3 4
((
# 6 "test_new.c"
x>0
# 6 "test_new.c" 3 4
) ? (void) (0) : __assert_fail (
# 6 "test_new.c"
"x>0"
# 6 "test_new.c" 3 4
, "test_new.c", 6, __PRETTY_FUNCTION__))
# 6 "test_new.c"
;
} |
Would you mind extending your test.c to have some code using the |
@tautschnig D'oh sorry, I've updated the comment with the information. |
Thanks a lot for the preprocessing, this is very insightful. |
I have cherry-picked this test into #755. |
Included in #974 |
The user added assert in this test does not get coverage under alpine linux.
I can make this a KNOWNBUG but I thought it would be useful for it to run on CI so everyone can see the problem. The problem seems to be to do with how the assert is handled (possibly caused by musl having a different assert.h when compared to glibc).
GOTO on Ubuntu Linux
GOTO on Alpine Linux