We have another VRP related test case for GCC-10.2.0. We expect A1.c and A2.c should compile to the same codes, but they did not. +---------------------------------+---------------------------------+ | A1.c | A2.c | +---------------------------------+---------------------------------+ |int main (void) |int main (void) | |{ |{ | | volatile int a = 1; | volatile int a = 1; | | | | | int b = a%2; | a; | | int t = 200<(short)(-50*b); | int t = 0; | | | | | if (t != 0) __builtin_abort(); | if (t != 0) __builtin_abort(); | | | | | return 0; | return 0; | |} |} | +---------------------------------+---------------------------------+ +-------------------------------+------------------------------+ | A1.s (gcc-10.2.0 A1.c -O3 -S) | A2.s (gcc-10.2.0 A2.c -O3 -S)| +-------------------------------+------------------------------+ |main: |main: | |.LFB0: |.LFB0: | | .cfi_startproc | .cfi_startproc | | subq $24, %rsp | movl $1, -4(%rsp) | | .cfi_def_cfa_offset 32 | movl -4(%rsp), %eax | | movl $1, 12(%rsp) | | | movl 12(%rsp), %eax | | | movl %eax, %edx | | | shrl $31, %edx | | | addl %edx, %eax | | | andl $1, %eax | | | subl %edx, %eax | | | imull $-50, %eax, %eax | | | cmpw $200, %ax | | | jg .L3 | | | xorl %eax, %eax | xorl %eax, %eax | | addq $24, %rsp | | | .cfi_def_cfa_offset 8 | | | ret | ret | | .cfi_endproc | .cfi_endproc | | .section .text.unlikely | | | .cfi_startproc | | | .type main.cold, @function| | |main.cold: | | |.LFSB0: | | |.L3: | | | .cfi_def_cfa_offset 32 | | | call abort | | | .cfi_endproc | | |.LFE0: |.LFE0: | | .section text.startup | | | .size main, .-main | .size main, .-main | | .section .text.unlikely | | | .size main.cold, .-mai...| | |.LCOLDE0: | | | .section .text.startup | | |.LHOTE0: | | | .ident "GCC: (GNU) 10.2.0"| .ident "GCC: (GNU) 10.2.0"| | .section .note.GNU-stac...| .section .note.GNU-stac...| +--------------------------------------------------------------+ $ gcc -v using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper target: x86_64-pc-linux-gnu configure woth: ../configure --enable-languages=c,c++ --prefix=/usr/local --disable-bootstrap --disable-multilib thred model: posix Supported LTO compression algorithms: zlib gcc version 10.2.0 (GCC)
Fixed in GCC 11 already.