[Bug ipa/96235] Segmentation fault with "-Og -fno-dce -fno-tree-dce -finline-small-functions -fipa-sra"

josephcsible at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 20 15:58:50 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96235

Joseph C. Sible <josephcsible at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |josephcsible at gmail dot com

--- Comment #2 from Joseph C. Sible <josephcsible at gmail dot com> ---
I can reproduce it on godbolt ("Program returned: 139"):
https://godbolt.org/z/c7eYzx

Here's the assembly output:

main:
        movslq  b(%rip), %rax
        cmpq    0, %rax
        cmpq    $0, d(%rip)
        movl    $0, %eax
        ret
c:
        .quad   1
d:
        .quad   1
b:
        .long   1

The problem is that "cmpq    0, %rax" tries to read memory at address 0.


More information about the Gcc-bugs mailing list