[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #8 from John David Anglin --- Created attachment 41897 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41897=edit miniperl debug session The flow and optimization of the Perl_custom_op_get_field function is quite complex. Two switch statements are merged and it appears that ultimately the wrong case is selected to load the return value. On entry, register %r3 contains the value 0x5aedb0. %r3 is not modified in the routine but it is eventually used to load the return value. 0x0001ab70: ldw 10(r3),ret0 It seems there is some confusion as to where the variable xop resides. When we hit the following statement, we have 14879 if(field == XOPe_xop_ptr) {(gdb) disass $pc-16,$pc+16 Dump of assembler code from 0x1aa28 to 0x1aa48: 0x0001aa28 : b,l 0x3b410,rp 0x0001aa2c : stw r0,0(r8) 0x0001aa30 : movb,<> ret0,r13,0x1aa74 0x0001aa34 : ldi 14,r25 => 0x0001aa38 : cmpib,= 0,r5,0x1ab94 0x0001aa3c : ldil L%186800,ret0 0x0001aa40 : ldo -1(r5),r5 0x0001aa44 : ldil L%1a800,ret0 End of assembler dump. (gdb) info address xop Symbol "xop" is multi-location: Range 0x1a988-0x1a9a4: a variable in $r3 Range 0x1a9ac-0x1a9b8: a variable in $r3 Range 0x1aa38-0x1aa40: a complex DWARF expression: 0: DW_OP_addr 0x186a88 5: DW_OP_stack_value Range 0x1aa44-0x1aa74: a variable in $r3 Range 0x1aa84-0x1ab94: a variable in $r3 Range 0x1ab94-0x1ab9c: a complex DWARF expression: 0: DW_OP_addr 0x186a88 5: DW_OP_stack_value Range 0x1ab9c-0x1abb4: a variable in $r3 . (gdb) p/x $r3 $2 = 0x5aedb0 (gdb) p xop $3 = (XOP *) 0x186a88 The variable he is always 0 in this call. So, nominally xop should point at xop_null. After we execute the switch statement, gdb thinks we are at line 14896: (gdb) stepi Perl_custom_op_get_field (my_perl=0x1e3008, o=0x5aee58, field=XOPe_xop_peep) at op.c:14896 14896 break; (gdb) disass $pc-16,$pc+16 Dump of assembler code from 0x1ab5c to 0x1ab7c: 0x0001ab5c : b,l 0x1a9b8 ,r0 0x0001ab60 : ldw 8(r3),ret0 0x0001ab64 : b,l 0x1a9b8 ,r0 0x0001ab68 : ldw 4(r3),ret0 => 0x0001ab6c : b,l 0x1a9b8 ,r0 0x0001ab70 : ldw 10(r3),ret0 0x0001ab74 : b,l 0x1a9b8 ,r0 0x0001ab78 : ldw c(r3),ret0 Line 14896 is in the first switch expression. This should result in xop->xop_peep being returned. However, here xop is supposed in register %r3. However, the flags value from xop_null is 0. So, the code should be returning XOPd_xop_peep (ie., ((Perl_cpeep_t)0)).
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #7 from John David Anglin --- Created attachment 41895 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41895=edit Function Perl_custom_op_get_field
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #6 from dave.anglin at bell dot net --- On 2017-07-25, at 2:46 PM, dave.anglin at bell dot net wrote: > Both gcc-5 and gcc-6 are broken. Take that back; only gcc-6 is broken. I incorrectly set the package up for gcc-5 in my first attempt and it used gcc-6. -- John David Anglin dave.ang...@bell.net
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #5 from dave.anglin at bell dot net --- On 2017-07-25, at 10:02 AM, dave.anglin at bell dot net wrote: > Will check gcc-5 when current build > completes. Both gcc-5 and gcc-6 are broken. -- John David Anglin dave.ang...@bell.net
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #4 from dave.anglin at bell dot net --- On 2017-07-25, at 3:46 AM, rguenth at gcc dot gnu.org wrote: > Any other compiler versions to put in known-to-work/fail? The fault doesn't occur with gcc-7: gcc version 7.1.0 (Debian 7.1.0-9). Will check gcc-5 when current build completes. -- John David Anglin dave.ang...@bell.net
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #3 from Richard Biener --- Any other compiler versions to put in known-to-work/fail?
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #2 from John Paul Adrian Glaubitz --- Adding Kaz and Oleg to CC since it affects sh*-*-* as well [1]. > [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869373
[Bug rtl-optimization/81538] Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538 --- Comment #1 from John David Anglin --- Created attachment 41820 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41820=edit .s file Assembler output for Perl_custom_op_get_field.