[MDEV-19709] Bitmap<128>::merge etc may crash on older GCC versions Created: 2019-06-07 Updated: 2019-06-19 Resolved: 2019-06-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Compiling |
| Affects Version/s: | 10.4 |
| Fix Version/s: | 10.4.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Older GCC incorrectly optimizes Bitmap<128> code by using SSE instructions on unaligned data. The compiller error was found on Ubuntu 16.04, CentOS 6/7. ------------- ------------- is compilled into the following instructions: ------------- The second operand of 'pand' instruction must be alligned to 16, otherwise -------------- There were also other instructions with non-alligned memory operand, for |
| Comments |
| Comment by Sergei Golubchik [ 2019-06-07 ] |
|
As far as I understand, there may be different ways to fix it. Disable SEE (locally) with a pragma, force alignment (with a pragma or an attribute or by moving from uint32 to ulonglong — I personally would try |
| Comment by Vladislav Vaintroub [ 2019-06-07 ] |
|
Serg, moving to ulonglong is not going to help here much, because alignment required for SSE instruction operands (such as pand or por that were the culprit) is not 64bit, but 128 bit. In the fix I use condition on _GNUC_ < 6, for the pragma, because gcc 6.3 did work ok, but gcc 5.4 did not. |
| Comment by Vladislav Vaintroub [ 2019-06-07 ] |
|
as a side note, a month ago or so, there was no sign of compiler bug on the same compilers. Something has changed since, maybe optimizer folks extended some structures, revealing the bug, or maybe something else got compiler to optimize too aggressively |
| Comment by Vladislav Lesin [ 2019-06-07 ] |
|
wlad, according to this https://mudongliang.github.io/x86/html/file_module_x86_id_230.html documentation, 'pand' memory operand must be aligned to 16, not to 128. |
| Comment by Vladislav Vaintroub [ 2019-06-07 ] |
|
vlad.lesin Yes, this is what I'm saying, counting in bits . |