[Bug rtl-optimization/81538] New: Optimization problem compiling op.c (Perl_custom_op_get_field) in perl 5.26
danglin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 24 17:58:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81538
Bug ID: 81538
Summary: Optimization problem compiling op.c
(Perl_custom_op_get_field) in perl 5.26
Product: gcc
Version: 6.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: danglin at gcc dot gnu.org
Target Milestone: ---
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Created attachment 41819
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41819&action=edit
Preprocessed source
Perl 5.26 (currently in experimental) has never built on hppa yet. It's
failing with
./miniperl -Ilib make_ext.pl cpan/Archive-Tar/pm_to_blib MAKE="/usr/bin/make"
LIBPERL_A=libperl.a
Unsuccessful Makefile.PL(cpan/Archive-Tar): code=11 at make_ext.pl line 518.
Miniperl branches to non existent code after calling Perl_custom_op_get_field:
Jul 20 20:18:48 mx3210 kernel: do_page_fault() command='miniperl' type=6
address=0xbf600703 in libcrypt-2.24.so[f77f9000+9000]
Jul 20 20:18:48 mx3210 kernel: trap #6: Instruction TLB miss fault, vm_start =
0x001e3000, vm_end = 0x005b4000
0x0002eac8 <Perl_rpeep+2896>: b,l 0x1a8d0
<Perl_custom_op_get_field>,rp
0x0002eacc <Perl_rpeep+2900>: copy r4,r26
0x0002ead0 <Perl_rpeep+2904>: movb,= ret0,r22,0x2e284
<Perl_rpeep+780>
0x0002ead4 <Perl_rpeep+2908>: copy r3,r25
0x0002ead8 <Perl_rpeep+2912>: copy r15,r24
0x0002eadc <Perl_rpeep+2916>: copy r4,r26
0x0002eae0 <Perl_rpeep+2920>: b,l 0x3b218,r31
0x0002eae4 <Perl_rpeep+2924>: copy r31,rp
The branch at Perl_rpeep+2920 is an indirect call using the function pointer
returned from calling Perl_custom_op_get_field. The value in $r22 for the
indirect call is 0xbf600701. It is not a valid function pointer.
This is debian bug #869122:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869122
The value returned by Perl_custom_op_get_field is wrong for the case
when xop == &xop_null. It appears to get messed up by the merging of the
two switch statements in the C code. The debian bug report has a patch
which revises the switch statements into one. With the patch, the perl
build is successful on both hppa and sh.
Attached preprocessed source. The compile command is:
/usr/lib/gcc/hppa-linux-gnu/6/cc1 -fpreprocessed opmini.i -quiet -dumpbase
opmini.c -auxbase opmini -g -g -O2 -O2 -Wdate-time -Wformat=1
-Werror=format-security -Wall -Werror=declaration-after-statement -Wextra
-Wc++-compat -Wwrite-strings -std=c90 -version
-fdebug-prefix-map=/home/dave/debian/perl/perl-5.26.0=. -fwrapv
-fno-strict-aliasing -o opmini.s
The perl 5.26 build is successful at -O0.
More information about the Gcc-bugs
mailing list