-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix checking for existing builtin overflow functions #958
Conversation
Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1448913 |
Failed job Build for x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1448912 |
Failed job Build for x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1449011 |
Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1449013 |
Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1451507 |
Failed job Build for x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1451506 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mustn't modify configure file by hands. Modify configure.in and regenerate configure file, instead.
This patch fixes commit 1ca5486, which added support of using builtin overflow functions: __builtin_add_overflow, __builtin_sub_overflow, __builtin_mul_overflow. The configure script tries to compile a small program with one of these functions. Compilation was without any errors, because to correctly check gcc requires flag -Werror=implicit-function-declaration. This flag is added later. This patch moves this check after flag -Werror=implicit-function-declaration is added to CFLAGS.
This patch fixes commit 1ca5486, which added support of using builtin overflow functions: __builtin_add_overflow, __builtin_sub_overflow, __builtin_mul_overflow. The configure script tries to compile a small program with one of these functions. Compilation was without any errors, because to correctly check gcc requires flag -Werror=implicit-function-declaration. This flag is added later. This patch moves this check after flag -Werror=implicit-function-declaration is added to CFLAGS.
Failed job Build for x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1451993 |
Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1451994 |
Otherwise the detection can spuriously detect symbol as available, because the compiler may just emits reference to non-existant symbol. (cherry picked from commit 85abb5b)
On some systems the results of 64 bit __builtin_mul_overflow() operations can be computed at compile time, but not at runtime. The known cases are arm buildfar animals using clang where the runtime operation is implemented in a unavailable function. Try to avoid compile-time computation by using volatile arguments to __builtin_mul_overflow(). In that case we hopefully will get a link error when unavailable, similar to what buildfarm animals dangomushi and gull are reporting. Author: Andres Freund Discussion: https://postgr.es/m/20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de (cherry picked from commit c04d35f)
Commit c04d35f didn't quite do the job here, because it still allowed the compiler to deduce that the function call could be optimized away. Prevent that by putting the arguments and results in global variables. Discussion: https://postgr.es/m/20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de (cherry picked from commit c6d21d5)
Failed job Build for x86_64: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1455592 |
Failed job Build for ppc64le: https://gitlab.adsw.io/arenadata/github_mirroring/gpdb/-/jobs/1455593 |
Commit 1ca5486 added support of using builtin functions:
Check for existing these functions was added to the
configure
script. But it did not work, becausegcc
printed warning instead of error and returned success code. To theconfdefs.h
macro#define HAVE__BUILTIN_OP_OVERFLOW 1
was printed and at themake
step compiler tried to build sources with these builtin functions. It lead to errors:At PostgreSQL there are commits, which fix the problem. These commits change
AC_COMPILE_IFELSE
toAC_LINK_IFELSE
for the test program at theconfigure
script, which should check for existing builtin functions.This patch cherry-picks three commits from postgres:
commit 85abb5b
commit c04d35f
commit c6d21d5
DO not squash it.
Error at the unit test will be fixed at the other PR. This PR fixes problem at the
configure
script. It means, that only building should be success. It was checked at the pipeline.