Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wrong behaviour of torad_coord() with gcc 8.1 -O2 (fixes #1084)
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. Reported as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86914 According to https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html, the proper way of declaring such arrays is to use [0]
- Loading branch information