codeblocks version 10.05-2 failed to build on armel

Bug #791327 reported by Ricardo Salveti
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Medium
Ramana Radhakrishnan
gcc
Fix Released
Medium
codeblocks (Ubuntu)
Fix Released
Undecided
Unassigned
gcc-4.6 (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

codeblocks version 10.05-2 failed to build on armel
Link to failed build: https://launchpad.net/ubuntu/+source/codeblocks/10.05-2/+build/2465152

Direct link to the build log: https://launchpad.net/ubuntu/+source/codeblocks/10.05-2/+build/2465152/+files/buildlog_ubuntu-oneiric-armel.codeblocks_10.05-2_FAILEDTOBUILD.txt.gz

This log snippet might be of interest, since it triggered the matcher 'Purging chroot-autobuild'.
Excerpt 3494 lines into the build log:

/tmp/ccQ2nsvc.s: Assembler messages:
/tmp/ccQ2nsvc.s:5100: Error: r13 not allowed here -- `rsb ip,sp,ip,lsl#2'
make[5]: *** [byocbtris.lo] Error 1
make[5]: Leaving directory `/build/buildd/codeblocks-10.05/src/plugins/contrib/byogames'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/build/buildd/codeblocks-10.05/src/plugins/contrib'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/build/buildd/codeblocks-10.05/src/plugins'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/build/buildd/codeblocks-10.05/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/build/buildd/codeblocks-10.05'
dh_auto_build: make -j1 returned exit code 2
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
******************************************************************************
Build finished at 20110512-0159
FAILED [dpkg-buildpackage died]
Purging chroot-autobuild/build/buildd/codeblocks-10.05

Related branches

Revision history for this message
Marcin Juszkiewicz (hrw) wrote :

Thumb2 issue?

Revision history for this message
Ramana Radhakrishnan (ramana) wrote :

This looks like a compiler bug.

bin/bash ../../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../../../src/include -I../../../../src/sdk/wxscintilla/include -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -c -o byocbtris.lo byocbtris.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/include -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../../../src/include -I../../../../src/sdk/wxscintilla/include -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -c byocbtris.cpp -fPIC -DPIC -o .libs/byocbtris.o
/tmp/ccQ2nsvc.s: Assembler messages:
/tmp/ccQ2nsvc.s:5100: Error: r13 not allowed here -- `rsb ip,sp,ip,lsl#2'

Reduced testcase :
g++ -c -O2 -march=armv7-a tst.cpp

$> cat tst.cpp

#include <string.h>
typedef int ChunkConfig[16];

void AlignChunk(ChunkConfig& chunk)
{

    int rowsShift = 0;
    while ( rowsShift<4 )
    {
        bool isEmpty = true;
        for ( int x=0; x<4; x++ )
            if ( chunk[rowsShift*4+x] != 0 )
            {
                isEmpty = false;
                break;
            }
        if ( !isEmpty ) break;
        rowsShift++;
    }

    int colsShift = 0;
    while ( colsShift<4 )
    {
        bool isEmpty = true;
        for ( int y=0; y<4; y++ )
            if ( chunk[colsShift+y*4] != 0 )
            {
                isEmpty = false;
                break;
            }
        if ( !isEmpty ) break;
        colsShift++;
    }

    if ( !colsShift && !rowsShift ) return;

    ChunkConfig newChunk;
    memset(newChunk,0,sizeof(newChunk));
    for ( int y=rowsShift,y2=0; y<4; y++,y2++ )
        for ( int x=colsShift,x2=0; x<4; x++,x2++ )
            newChunk[x2+y2*4] = chunk[x+y*4];
    memcpy(chunk,newChunk,sizeof(chunk));
}

Ramana

Revision history for this message
In , Michael Hope (michaelh1) wrote :

Created attachment 24468
Reduced test case

The attached testcase is derived from codeblocks 10.05 and fails to build on ARM due to generating invalid assembler.

To reproduce:

michaelh@ursa2:~/linaro/bugs$ ~/linaro/toolchains/gcc-4.7~svn174795-armv7l-maverick-cbuild127-ursa3-cortexa9r1/bin/g++ -c -O2 -save-temps lp791327.cpp

lp791327.s: Assembler messages:
lp791327.s:76: Error: r13 not allowed here -- `rsb r0,sp,r0,lsl#2'

The fault occurs in 4.6.0 and current trunk. It does not occur in 4.5.3.

Originally reported at https://bugs.launchpad.net/ubuntu/+source/codeblocks/+bug/791327

Revision history for this message
In , Michael Hope (michaelh1) wrote :

Forgot the configuration:

Configured with: '../../gcc-4.7~/configure' --prefix='/scratch/cbuild/slave/slaves/ursa3/gcc-4.7~svn174795/gcc/default/install' --enable-languages=c,c++,objc,obj-c++,fortran,lto --with-mode=thumb --with-arch=armv7-a --with-tune=cortex-a9 --with-float=softfp --with-fpu=neon
Thread model: posix
gcc version 4.7.0 20110608 (experimental) [trunk revision 174795] (GCC)

michaelh@ursa2:~/linaro/bugs$ as -v
GNU assembler version 2.20.51 (arm-linux-gnueabi) using BFD version (GNU Binutils for Ubuntu) 2.20.51-system.20100908

michaelh@ursa2:~/linaro/bugs$ uname -a
Linux ursa2 2.6.35.3-cbuild2+ #8 SMP Mon Apr 4 12:46:46 NZST 2011 armv7l GNU/Linux

michaelh@ursa2:~/linaro/bugs$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.10
Release: 10.10
Codename: maverick

The fault also occurs at -O1 and -O3 but not at -O0.

The assembly in the region is:

.L33:
 movs r1, #0
 movs r2, #64
 mov r0, sp
 mov r9, sp
 bl memset
 cmp r4, #4
 beq .L11
 add r0, r8, r4, lsl #2
 rsb r6, r8, #4
 lsls r6, r6, #2
 rsb r1, r4, #4
 rsb r0, sp, r0, lsl #2
 mov r4, sp
 mov lr, #0

which matches the final lines of the function. It looks like the code should be using r9 instead of sp.

Revision history for this message
Michael Hope (michaelh1) wrote :

Submitted upstream: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49335

Launchpad won't let me attach it...

Changed in gcc-linaro:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Michael Hope (michaelh1) wrote :

Confirmed in gcc-linaro-4.6-2011.05, gcc-4.6.0, and gcc trunk r174795.

Does not exist in gcc-linaro-4.5-2011.05 or gcc 4.5.3.

Fails at -O1, -O2, and -O3. The work-around is to build at -O0.

Changed in gcc-linaro:
status: Confirmed → Triaged
Revision history for this message
In , Ramana-gcc (ramana-gcc) wrote :

The problem is that *arith_shiftsi allows *all* shiftable operators to have the stack pointer as Rn .

In Thumb2 only the add and sub instructions are allowed to have the stack pointer in this form and all other instructions are UNPREDICTABLE. This has come as a result of merging the 2 patterns from ARM and Thumb2 into a single pattern and considering the same for both.

Affects only 4.6 branch and FSF trunk.

cheers
Ramana

Revision history for this message
In , Ramana-gcc (ramana-gcc) wrote :

(In reply to comment #2)
> The problem is that *arith_shiftsi allows *all* shiftable operators to have the
> stack pointer as Rn .
>
> In Thumb2 only the add and sub instructions are allowed to have the stack
> pointer in this form and all other instructions are UNPREDICTABLE.

This is for operations of the form :

<operation> rd, rn, rm lsl 2

cheers
Ramana

Marcin Juszkiewicz (hrw)
affects: codeblocks → gcc
Revision history for this message
In , Michael Hope (michaelh1) wrote :

Also affects gimp. See LP: #791279.

Doesn't appear in trunk r172224 but does in r174795.

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Ramana-gcc (ramana-gcc) wrote :

Author: ramana
Date: Fri Jun 24 13:15:08 2011
New Revision: 175375

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175375
Log:
Fix PR target/49335

2011-06-24 Ramana Radhakrishnan <email address hidden>

 PR target/49335
 * config/arm/predicates.md (add_operator): New.
 * config/arm/arm.md ("*arith_shiftsi"): Fix for SP reg usage
 in Thumb2.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.md
    trunk/gcc/config/arm/predicates.md

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

GCC 4.6.1 is being released.

Changed in gcc-linaro:
assignee: nobody → Ramana Radhakrishnan (ramana)
milestone: none → 4.6-2011.07
status: Triaged → Fix Committed
Revision history for this message
In , Ramana-gcc (ramana-gcc) wrote :

Author: ramana
Date: Wed Jul 6 12:38:26 2011
New Revision: 175911

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175911
Log:

2011-07-06 Ramana Radhakrishnan <email address hidden>

 Backport from mainline.
 2011-06-24 Ramana Radhakrishnan <email address hidden>

 PR target/49335
 * config/arm/predicates.md (add_operator): New.
 * config/arm/arm.md ("*arith_shiftsi"): Fix for SP reg usage
 in Thumb2.

Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/arm/arm.md
    branches/gcc-4_6-branch/gcc/config/arm/predicates.md

Revision history for this message
In , Ramana-gcc (ramana-gcc) wrote :

Fixed.

Changed in gcc:
status: Confirmed → Fix Released
Changed in gcc-4.6 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Michael Hope (michaelh1)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.6 - 4.6.1-4ubuntu2

---------------
gcc-4.6 (4.6.1-4ubuntu2) oneiric; urgency=low

  * Update to SVN 20110720 (r176494) from the gcc-4_6-branch.
    - Fix PR target/49541, PR tree-optimization/49768, PR middle-end/49675,
      PR target/49746, PR middle-end/49732, PR tree-optimization/49725,
      PR target/49723, PR target/49541, PR tree-opt/49309, PR c++/49785,
      PR ada/48711, PR ada/46350, PR fortran/49648, PR testsuite/49753,
      PR tree-optimization/49309.
  * Update the Linaro support to the 4.6-2011.07-0 release.
    - Fix PR target/49335. LP: #791327.
  * Update gcc-multiarch:
    - Add -print-multiarch option.
    - Fix library path for non-default multilib(s).
    - Handle `.' in MULTILIB_DIRNAMES.
  * Add support to build multilib on armel and armhf, only enable it for
    Ubuntu/oneiric. LP: #810360.
 -- Matthias Klose <email address hidden> Wed, 20 Jul 2011 17:44:32 +0200

Changed in gcc-4.6 (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Rebuild worked fine.

Changed in codeblocks (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.