Wrong code generation for -march=armv7-a -thumb (Found during gmp make check)

Bug #1234060 reported by Kugan Vivekanandarajah
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Undecided
Kugan Vivekanandarajah
gcc-4.8 (Ubuntu)
Fix Released
High
Unassigned
Saucy
Fix Released
High
Unassigned

Bug Description

Attached testcase fails in -march=armv7-a -thumb for -O1 but works for -O0

gcc trunk however is working with -O1 (and above).

arm-none-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/home/kugan/work/builds/gcc-linaro-4.8/tools/bin/arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/kugan/work/builds/gcc-linaro-4.8/tools/libexec/gcc/arm-none-linux-gnueabi/4.8.2/lto-wrapper
Target: arm-none-linux-gnueabi
Configured with: /home/kugan/work/sources/gcc-linaro/4.8/configure --target=arm-none-linux-gnueabi --prefix=/home/kugan/work/builds/gcc-linaro-4.8/tools --with-sysroot=/home/kugan/work/builds/gcc-linaro-4.8/sysroot-arm-none-linux-gnueabi --disable-libssp --disable-libgomp --disable-libmudflap --enable-languages=c,c++ --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp --with-thumb
Thread model: posix
gcc version 4.8.2 20130920 (prerelease) (Linaro GCC release=4.8-2013.09-1~dev)

Revision history for this message
Kugan Vivekanandarajah (kugan-vivekanandarajah) wrote :
Changed in gcc-linaro:
assignee: nobody → Kugan Vivekanandarajah (kugan-vivekanandarajah)
Revision history for this message
Matthias Klose (doko) wrote :

works with trunk

Changed in gcc-4.8 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Matthias Klose (doko) wrote :

works with 4.8 fsf, and 4.7 fsf, and 4.7 linaro

Changed in gcc-4.8 (Ubuntu Saucy):
milestone: none → ubuntu-13.10
Revision history for this message
Christophe Lyon (christophe-lyon) wrote :

According to Kugan, seems to be fixed by commit 201250 on trunk, which I have just backported in linaro-4.8 branch as 203139.

Revision history for this message
Kugan Vivekanandarajah (kugan-vivekanandarajah) wrote :

Generated code is wrong due to the output template of the patterns (please see below). Commit 201250 Fixes it.

243.dfinish
=============
(insn 62 61 63 2 (set (reg:SI 3 r3 [orig:156 _qh ] [156])
        (plus:SI (plus:SI (geu:SI (reg:CC 100 cc)
                    (const_int 0 [0]))
                (reg:SI 3 r3 [orig:151 D.4776 ] [151]))
            (reg/v:SI 1 r1 [orig:110 __x3 ] [110]))) test.c:44 18 {*addsi3_carryin_alt2_geu}
     (expr_list:REG_DEAD (reg:CC 100 cc)
        (expr_list:REG_DEAD (reg/v:SI 1 r1 [orig:110 __x3 ] [110])
            (nil))))

Generated Wrong Code
===============
adc r3, r3 @ 62 *addsi3_carryin_alt2_geu/1 [length = 4]

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.8 - 4.8.1-10ubuntu6

---------------
gcc-4.8 (4.8.1-10ubuntu6) saucy; urgency=low

  * [ARM] Fix bug in add patterns due to commutativity modifier,
    backport from trunk. LP: #1234060.
  * Build libatomic on AArch64.
 -- Matthias Klose <email address hidden> Wed, 02 Oct 2013 14:57:31 +0200

Changed in gcc-4.8 (Ubuntu Saucy):
status: Confirmed → Fix Released
Changed in gcc-linaro:
status: New → Fix Committed
Revision history for this message
Kugan Vivekanandarajah (kugan-vivekanandarajah) wrote :

All the gmp testcases pass now.

summary: - Wrong code generation for -march=armv7-a -thumb (Found during GMP
- bulild)
+ Wrong code generation for -march=armv7-a -thumb (Found during gmp make
+ check)
Viktor (vchong)
Changed in gcc-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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