[MDEV-21362] do something with -fno-builtin-memcmp for rem0cmp.cc Created: 2019-12-19 Updated: 2020-01-29 Resolved: 2019-12-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Compiling, Storage Engine - InnoDB |
| Fix Version/s: | 10.2.31, 10.3.22, 10.4.12, 10.5.1 |
| Type: | Task | Priority: | Major |
| Reporter: | Eugene Kosov (Inactive) | Assignee: | Eugene Kosov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance | ||
| Description |
|
This was added to mitigate poor compiler optimization. As I can see, it was fixed in gcc-4.6 https://godbolt.org/z/7G64qo For 10.5 we support at least gcc-4.8 so this CMake code can be removed. For older versions it should be replaced with some preprocessor condition to check compiler name and version. |
| Comments |
| Comment by Marko Mäkelä [ 2019-12-23 ] | |||||||||||||||
|
Thank you! It looks good to me. | |||||||||||||||
| Comment by Marko Mäkelä [ 2020-01-29 ] | |||||||||||||||
|
The 10.5 version of the change introduced a WITH_UBSAN failure, by removing the zero check on len before invoking memcmp(). The function parameters can be null pointers in this case, and memcmp(nullptr,nullptr,0) is undefined behaviour, and it will allow GCC 8 (or later) to infer that the pointer arguments are nonnull, and to optimize away further nullness checks for them. That actually happened in
With this change, WITH_UBSAN should be happy. The following tests cover this condition:
| |||||||||||||||
| Comment by Marko Mäkelä [ 2020-01-29 ] | |||||||||||||||
|
The minor regression (with no observed effects outside WITH_UBSAN) is now fixed in the 10.5 branch. It was not part of any release yet. |