The code with inline assembly fails to compile with the solc binaries from soliditylang.org. The same code compiles without issue using Remix or solcjs. Because of this issue I cannot even compile the basic sample project shipped with hardhat. I assume this is not a bug, so what am I missing?
To replicate you can try the following on any linux distro:
curl -O 'https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Address.sol'
curl -O 'https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.8.10+commit.fc410830'
chmod +x solc-linux*
./solc-linux-amd64-v0.8.10+commit.fc410830 --bin Address.sol # fails due to inline assembly in the isContract function
solcjs --bin Address.sol # successfully compiles
(Update) This is crazy:
- Fails to compile code with inline assembly on my pc (fedora 33) and another machine I have (void linux)
- Compiles when I run the compiler through fedora:33 with docker
- Fails to compile when I ssh into a cloud instance running fedora 33, but others can compile running the same code on the same remote machine
- Compiles when I ssh into the same remote cloud instance machine using the aforementioned fedora:33 docker instance
- Compiles when I ssh into another cloud instance running Debian
Best Answer
Solved. Compiler misbehaves when system locale is set to Turkish. I have submitted a bug report. https://github.com/ethereum/solidity/issues/12350