Comment 5 for bug 1353729

Revision history for this message
In , Palachev-ilya (palachev-ilya) wrote :

Created attachment 110
The patch that fixes error (maybe incorrect!)

The error is related with legacy built-in functions for atomic memory access
https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/_005f_005fsync-Builtins.html#_005f_005fsync-Builtins

Such builtins are expanded to atomic_* instructions at expand pass.

It has been found that usually all atomic_* RTL instructions (except atomic_store*) are splitted out after pass split2 (you can check it by compiling sync-1.c from gcc testuite). So there must not be any atomic_* after split2 (except atomic_store*).
But in our case insn atomic_orsi was not splitted out after split2 and stayed in code till to the final pass.

Final pass also tries to split all instrutions, but it fails with assertion, if at least 1 insn can not be splitted.

So the first erroneous behavior appears at least at split2 pass.

It checks the operand of atomic_orsi, using function aarch64_logical_operand return false for 0.

In the attached patch i tried to allow aarch64_logical_operand to work with 0 case.

Is it correct?