-
Notifications
You must be signed in to change notification settings - Fork 802
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
4D-API_cs2cs-style.gie fails on Debian unstable (with GCC 8) #1084
Comments
torad_coord() of gie.c has this sequence: ``` if( cond ) axis = l->param + strlen ("axis="); n = strlen (axis); ``` When the if branch is evaluated, n is always zero even if on inspection axis is non empty The reason is that the struct ARG_list which is the type of l use a variable-length array for the param member struct ARG_list { paralist *next; char used; char param[1]; }; But this is not a proper way of declaring it, and gcc 8 has apparently optimizations to detect that l->param + 5 points out of the array, hence it optimizes strlen() to 0. According to https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html, the proper way of declaring such arrays is to use [0]
Fix wrong behaviour of torad_coord() with gcc 8.1 -O2 (fixes #1084)
@sebastic. Fixed. I suspect a gcc optimization bug (reported as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914 ) |
Thanks for the patch and in-depth analysis. I've included the changes from 143b4d3 as a patch in the 5.1.0 Debian package, but the test still fails in the same way:
Full buildlog: proj_5.1.0-2_amd64.txt |
@sebastic Weird. Can you just try to build master and make check (after installing egm96_15.gtx in nad/) with the same compiler ? |
|
OK, I can reproduce within a Debian unstable VM with gcc 8.2. Regarding the first failure initially reported (4D-API_cs2cs-style.gie(114)), this is a difference between gcc 8.1 and 8.2, and the later only generates the correct code if using the [] syntax (I've updated https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914 with it). Investigating for the new issue: 4D-API_cs2cs-style.gie(256) |
Confirmed fixed with the changes from edfa298, thanks! |
4D-API_cs2cs-style.gie
started to fail on Debian unstable recently. Quite possibly related to GCC 8 becoming the default compiler.The text was updated successfully, but these errors were encountered: