NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/45439: gcc generates out-of-range branch insn for m68k



>Number:         45439
>Category:       toolchain
>Synopsis:       gcc generates out-of-range branch insn for m68k
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 07 13:25:00 +0000 2011
>Originator:     Hauke Fath
>Release:        NetBSD 5.1_STABLE
>Organization:
-- 
     The ASCII Ribbon Campaign                    Hauke Fath
()     No HTML/RTF in email             Institut für Nachrichtentechnik
/\     No Word docs in email                     TU Darmstadt
     Respect for open standards              Ruf +49-6151-16-3281
>Environment:
        
        
System: NetBSD fattie.causeuse.org 5.1_STABLE NetBSD 5.1_STABLE (Q650) #0: Thu 
Apr 21 16:03:44 CEST 2011  
hauke%fattie.causeuse.org@localhost:/bsdsrc/netbsd-5/src/sys/arch/mac68k/compile/Q650
 mac68k
Architecture: m68k
Machine: mac68k
>Description:

        During the build of perl 5.14.[12] (pkgsrc lang/perl5), the
        gcc 4.1.3 on NetBSD/m68k generates an out-of-range FPU
        assembler branch instruction:

[...]
Making all in ext/re
 /usr/bin/make all PERL_CORE=1 LIBPERL_A=libperl.so LINKTYPE=dynamic
cp re.pm ../../lib/re.pm
rm -f re_exec.c
cp ../../regexec.c re_exec.c
cc -c    -O2 -pthread -I/usr/include -fno-strict-aliasing -pipe 
-fstack-protector -I/usr/pkg/include -O2 -pthread -I/usr/include    
-DVERSION=\"0.18\"  -DXS_VERSION=\"0.18\" -DPIC -fPIC "-I../.."  
-DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT re_exec.c
{standard input}: Assembler messages:
{standard input}:18033: Error: value out of range
*** Error code 1Unsuccessful make(ext/re): code=256 at make_ext.pl line 463.

Stop.
make: stopped in /var/obj/pkgsrc/lang/perl5/work/perl-5.14.2/ext/re
*** Error code 25*** Error code 1

        The relevant assembler procedure is
[...]
   8485 .L3744:
   8486         move.l PL_memory_wrap@GOT(%a5),-(%sp)
   8487         move.l .LC68@GOT(%a5),-(%sp)
   8488         bsr.l Perl_croak_nocontext@PLTPC
[...]
  18029 .L2762:
  18030         fmovecr #0xf,%fp1
  18031         fadd.x %fp1,%fp0
  18032         fcmp.d #0r1.073741823e+9,%fp0
>>18033         fbgt .L3744
  18034         lsl.l #2,%d0
  18035         move.l %d0,-(%sp)
  18036         bsr.l Perl_safesysmalloc@PLTPC
  18037         move.l %a0,588(%a4)
  18038         clr.l -260(%fp)
  18039         clr.l (%sp)
  18040         move.l %a4,-(%sp)
  18041         bsr.l S_regcppush@PLTPC
  18042         move.l %d5,%a0
  18043         move.l %d0,28(%a0)
  18044         move.l -36(%fp),%d0
  18045         addq.l #8,%sp
  18046         btst #19,%d0
  18047         jbeq .L2765
  18048         jbra .L3880
[...]

        with L3744 being (too) pretty far away in the source code.

        See also
        <http://mail-index.netbsd.org/port-m68k/2011/09/oindex.html>.


        Files provided: 

        ext/re/re_exec.s is at
        <http://la.causeuse.org/hauke/NetBSD/gcc-m68k-perl/re_exec.s.gz>,
        built with

% cc -S -O2 -pthread -I/usr/include -fno-strict-aliasing -pipe 
-fstack-protector -I/usr/include -DVERSION=\"0.18\" -DXS_VERSION=\"0.18\" -DPIC 
-fPIC "-I../.." -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT re_exec.c
%

        ext/re/verbose-re_exec.s (different line numbers) is at
        
<http://la.causeuse.org/hauke/NetBSD/gcc-m68k-perl/verbose-re_exec.s.gz>,
        built with

% cc -S -fverbose-asm -O2 -pthread -I/usr/include -fno-strict-aliasing -pipe 
-fstack-protector -I/usr/include -DVERSION=\"0.18\" -DXS_VERSION=\"0.18\" -DPIC 
-fPIC "-I../.." -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT re_exec.c
%

        ext/re/re_exec.i (preprocessor output) is at
        <http://la.causeuse.org/hauke/NetBSD/gcc-m68k-perl/re_exec.i.gz>,
        built with

% cc -E -O2 -pthread -I/usr/include -fno-strict-aliasing -pipe 
-fstack-protector -I/usr/include -DVERSION=\"0.18\" -DXS_VERSION=\"0.18\" -DPIC 
-fPIC "-I../.." -DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT re_exec.c > 
re_exec.i
%

        The problem can be reproduced by compiling the preprocessed file.

        
>How-To-Repeat:

        Build lang/perl5 on a netbsd-5 m68k machine. I don't know
        about -current, but m68k still defaults to gcc 4.1.3 because
        of gcc 4.5 m68k breakage.


>Fix:

        Fix gcc m68k code generation. A workaround appears to build
        with -Os instead of the default -O2.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index