-
Notifications
You must be signed in to change notification settings - Fork 11k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LoopStrengthReduce incorrectly rewrites UREM (wrong code at -O3 on x86_64-linux-gnu in 64-bit mode (not in 32-bit mode)) #38847
Comments
Marking as confirmed - this still shows the same failure at r346802. |
The latest version this reproduces with the C code is 12.0 with the following extra flags |
It looks like the issue here is in I think I managed to isolate the incorrect transform to the following: https://godbolt.org/z/PxGzTWrqr
This can lead to an incorrect return value: https://alive2.llvm.org/ce/z/7Ztnov |
Proposed fix https://reviews.llvm.org/D151394 |
Extended Description
Tested with trunk revision 345488.
$ clangpolly -v
clang version 8.0.0 (http://llvm.org/git/clang.git 8029b38886dd239769e3501dac21438e16886ce8) (llvm/trunk 345488)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@MX32
Selected multilib: .;@m64
$
$ clangpolly -m64 -O2 small.c
$ ./a.out
$
$ clangpolly -m32 -O3 small.c
$ ./a.out
$
$ clangpolly -m64 -O3 small.c
$ ./a.out
Floating point exception (core dumped)
$
The text was updated successfully, but these errors were encountered: