[Bug rtl-optimization/95123] [10/11 Regression] Wrong code w/ -O2 -fselective-scheduling2 -funroll-loops --param early-inlining-insns=5 --param loop-invariant-max-bbs-in-loop=3 --param max-jump-thread-duplication-stmts=0

asolokha at gmx dot com gcc-bugzilla@gcc.gnu.org
Thu May 14 10:35:37 GMT 2020


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

--- Comment #4 from Arseny Solokha <asolokha at gmx dot com> ---
(In reply to Martin Liška from comment #2)
> I can't reproduce that with the mentioned revision.
> Where does it segfault?

Program received signal SIGSEGV, Segmentation fault.
main () at iu1wkpbg.c:39
39            qe (ip[xh]);
(gdb) disassemble 
Dump of assembler code for function main:

<…>

   0x000055555555461f <+159>:   je     0x5555555545a0 <main+32>
   0x0000555555554625 <+165>:   xor    %ebp,%ebp
   0x0000555555554627 <+167>:   xor    %edi,%edi
   0x0000555555554629 <+169>:   callq  0x5555555547e0 <qe>
   0x000055555555462e <+174>:   cmp    $0x2,%ebx
   0x0000555555554631 <+177>:   lea    0x2a8(%rip),%rsi        # 0x5555555548e0
<ip>
   0x0000555555554638 <+184>:   mov    %ebp,%esi
   0x000055555555463a <+186>:   je     0x555555554650 <main+208>
   0x000055555555463c <+188>:   add    $0x1,%rbp
   0x0000555555554640 <+192>:   cmp    $0x5,%rbp
   0x0000555555554644 <+196>:   je     0x55555555466f <main+239>
=> 0x0000555555554646 <+198>:   mov    (%rsi,%rbp,4),%edi
   0x0000555555554649 <+201>:   jmp    0x555555554629 <main+169>

<…>

(gdb) info registers rsi
rsi            0x0                 0

In a good version I see this instead:

 636:   8b 3c a8                mov    (%rax,%rbp,4),%edi


More information about the Gcc-bugs mailing list