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

Tests fail to compile with GCC 14 #187

Open
eli-schwartz opened this issue Sep 17, 2024 · 0 comments
Open

Tests fail to compile with GCC 14 #187

eli-schwartz opened this issue Sep 17, 2024 · 0 comments

Comments

@eli-schwartz
Copy link

https://wiki.gentoo.org/wiki/Modern_C_porting#How_do_I_reproduce_these_bugs.3F

GCC 14 and clang 16 have started to error on invalid C code that was removed from the standard in c99 or even earlier. Historically, compilers accepted this code even though it was invalid in an effort to avoid breaking really old codebases. Due to the passing of time and an increasing understanding of just how dangerous this invalid code is, that leniency is going away.

Note that this is not cosmetic. It is undefined behavior and compilers will (increasingly) optimize it in weird and wonderful ways that break the original intention of the code. It will also obviously mean that the code cannot be built on newer systems with updated compilers.

An easy way to reproduce the problem even on older compiler versions is to build with the following *FLAGS:

-Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types

Lurch itself builds successfully, but it fails to build the testsuite:

cc -pipe -march=native -fstack-protector-all -O2 -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -std=c11 -Wall -g -Wstrict-overflow -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libpurple -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/libomemo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/axc -I/usr/include/signal -I/usr/include/signal -I./headers/jabber -O0 -c ./test/test_lurch_util.c -o build/test_lurch_util.o
./test/test_lurch_util.c: In function ‘test_lurch_util_axc_log_func_error’:
./test/test_lurch_util.c:69:5: error: implicit declaration of function ‘lurch_util_axc_log_func’ [-Werror=implicit-function-declaration]
   69 |     lurch_util_axc_log_func(AXC_LOG_ERROR, "test", 4, axc_ctx_p);
      |     ^~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:154: build/test_lurch_util.o] Error 1
 * ERROR: x11-plugins/lurch-0.7.0-r1::gentoo failed (test phase):

Full build log: build.log

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

1 participant