[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
Launchpad has imported 13 comments from the remote bug at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52294. If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://help.launchpad.net/InterBugTracking. On 2012-02-17T09:57:34+00:00 Bernhard Rosenkraenzer wrote: Created attachment 26693 Preprocessed source triggering this issue [bero@localhost ~]$ /opt/android-toolchain-4.7/bin/arm-linux-androideabi-g++ -mcpu=cortex-a9 -mthumb -Os -o agc2_amr_wb.o -c agc2_amr_wb.i /tmp/ccBg0Qr8.s: Assembler messages: /tmp/ccBg0Qr8.s:110: Error: branch out of range The problem disappears when taking out -mcpu=cortex-a9 or replacing -Os with any other optimization level. Reproducable with arm-linux-androideabi, arm-eabi and arm-linux-gnueabi compilers. Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/7 On 2012-02-17T10:46:11+00:00 Mikpe wrote: Fails with gcc 4.7 but works with 4.6, 4.5, and 4.4. Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/8 On 2012-02-17T23:22:41+00:00 Rearnsha wrote: Confirmed. lsls Rd, Rn, Rm is only 2 bytes in size if Rd == Rn Although the testcase only fails on trunk, the miscalculation is certain to be present on all maintained branches. Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/9 On 2012-02-18T12:27:50+00:00 stevenb wrote: Richard, I suppose you mean the problem is in this define_insn: (define_insn *thumb1_ashlsi3 [(set (match_operand:SI0 register_operand =l,l) (ashift:SI (match_operand:SI 1 register_operand l,0) (match_operand:SI 2 nonmemory_operand N,l)))] TARGET_THUMB1 lsl\\t%0, %1, %2 [(set_attr length 2) (set_attr conds set)]) which should set length depending on the operands? (BTW when should ARM_LSL_NAME be used instead of lsl? Or is ARM_LSL_NAME not relevant for Thumb?) Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/10 On 2012-02-18T12:36:29+00:00 stevenb wrote: (If the pattern of comment #3 is to blame, then this goes back all the way to the check-in of that pattern, see http://gcc.gnu.org/viewcvs?view=revisionrevision=33028) Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/11 On 2012-02-18T12:46:00+00:00 stevenb wrote: (In reply to comment #4) (If the pattern of comment #3 is to blame, then this ... ...probably fix it. Index: arm.md === --- arm.md (revision 184318) +++ arm.md (working copy) @@ -3505,7 +3505,12 @@ (match_operand:SI 2 nonmemory_operand N,l)))] TARGET_THUMB1 lsl\\t%0, %1, %2 - [(set_attr length 2) + [(set (attr length) + (if_then_else +(eq (symbol_ref (which_alternative)) +(const_int 0)) +(const_int 4) +(const_int 2))) (set_attr conds set)]) (define_expand ashrdi3 And otherwise: sorry for all the noise :-) Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/12 On 2012-02-18T12:47:20+00:00 stevenb wrote: Or better: Index: arm.md === --- arm.md (revision 184318) +++ arm.md (working copy) @@ -3505,7 +3505,7 @@ (match_operand:SI 2 nonmemory_operand N,l)))] TARGET_THUMB1 lsl\\t%0, %1, %2 - [(set_attr length 2) + [(set_attr length 4,2) (set_attr conds set)]) (define_expand ashrdi3 Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/13 On 2012-02-18T15:25:01+00:00 Rearnsha wrote: (In reply to comment #3) Richard, I suppose you mean the problem is in this define_insn: (define_insn *thumb1_ashlsi3 [(set (match_operand:SI0 register_operand =l,l) (ashift:SI (match_operand:SI 1 register_operand l,0) (match_operand:SI 2 nonmemory_operand N,l)))] TARGET_THUMB1 lsl\\t%0, %1, %2 [(set_attr length 2) (set_attr conds set)]) No, that pattern is only for Thumb1, it never applies to Thumb2. I'm currently testing a fix Reply at: https://bugs.launchpad.net/gcc/+bug/926855/comments/14 On 2012-02-21T15:38:40+00:00 Rearnsha wrote: Author: rearnsha Date: Tue Feb 21 15:38:35 2012 New Revision: 184442 URL:
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
** Changed in: gcc-linaro Status: Fix Committed = Fix Released -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
** Also affects: gcc via http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52294 Importance: Unknown Status: Unknown ** Changed in: gcc-linaro Status: In Progress = Fix Committed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
Assigning to Andrew as it will be picked up with the next merge. ** Changed in: gcc-linaro Status: Triaged = In Progress ** Changed in: gcc-linaro Assignee: (unassigned) = Andrew Stubbs (ams-codesourcery) ** Changed in: gcc-linaro Milestone: None = 4.6-2012.03 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
I can confirm 4.6.2-16ubuntu1, uploaded Thu, 23 Feb 2012 19:39:11 +0100 fixes the problem : I can compile sage without compiler problems! Thanks! -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
This ticket appears to be the same as: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52294. a case where gcc generates a cbz instruction that ends up trying to reach too far. Attaching the assembly file mp.s generated with: asa-san@ursa4:~/bugs/mp$ /scratch/asa-san/cbuild/slaves/ursa4/gcc-linaro-4.6-2012.01/gcc-binary/bin/gcc -c -o mp.o mp.c -O3 -funroll-loops -save-temps -dp mp.s: Assembler messages: mp.s:116: Error: branch out of range mp.s:343: Error: branch out of range The patch by Richard Earnshaw affects the pattern *thumb2_shiftsi3_short in the backend. Looking into mp.s, there are a lot of instructions that were generated from this pattern by the compiler. lslsr3, r3, #2 @ 426 *thumb2_shiftsi3_short [length = 2] The patch will become availabel in gcc-linaro-4.6 on the nextmerge from FSF trunk. and that should solve this issue. ** Bug watch added: GCC Bugzilla #52294 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52294 ** Attachment added: mp.s.tar.xz https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/926855/+attachment/2778566/+files/mp.s.tar.xz -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
fixed in 4.6.2-16ubuntu1 ** Changed in: gcc-4.6 (Ubuntu) Status: Confirmed = Fix Released -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
Re: [Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
Hi Michael, I cant' find any asm chunks in there. (Only in some external declarations.) Can it look any other way? /Åsa On 15 February 2012 22:39, Michael Hope 926...@bugs.launchpad.net wrote: Asa, does the code contain any inline assembly? GCC estimates the size of each instruction and uses that to decide if it can use a short or a long branch. Long chunks of inline assembly can break that and make it think the code is shorter than it is. -- You received this bug notification because you are a member of Linaro Toolchain Developers, which is subscribed to Linaro GCC. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile Status in Linaro GCC: Triaged Status in “gcc-4.6” package in Ubuntu: Confirmed Bug description: I'm porting the sagemath software to ARM. I completed the port with ubuntu oneiric. I upgraded to (a snapshot of) precise, and now a single file in the whole project doesn't build anymore. Hence something has been broken from oneiric/armel to precise/armhf. The attached mp.c is a gcc -E version of the problematic file, so it allows to easily reproduce the issue without fuss : if you compile it with gcc -c -o mp.o mp.c -O3 -funroll-loops, then the assembler will find two cases of branch out of range. Other switch combinations don't give problems, and the same combination is ok on x86_64 for example. Ah, on precise the gcc version is the one of Fri, 20 Jan 2012 12:10:59 +100 uploaded by doko, and changelog Merge with debian. There's no problem giving more details or doing tests if you want. To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
Asa, does the code contain any inline assembly? GCC estimates the size of each instruction and uses that to decide if it can use a short or a long branch. Long chunks of inline assembly can break that and make it think the code is shorter than it is. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
Thank you for the bug report. I've confirmed this with gcc- linaro-4.6-2012.01 on ARM: asa-san@ursa4:~/bugs/mp$ /scratch/asa-san/cbuild/slaves/ursa4/gcc-linaro-4.6-2012.01/gcc-binary/bin/gcc -c -o mp.o mp.c -O3 -funroll-loops /tmp/ccv0lfQ5.s: Assembler messages: /tmp/ccv0lfQ5.s:116: Error: branch out of range /tmp/ccv0lfQ5.s:343: Error: branch out of range The work around is to compiler at -O1 or to remove the -funroll-loops flag. The fault does not exist in FSF gcc-4.5.3 or gcc-4.6.2 Neither does it exist on gcc-linaro-4.5-2012.01. The fault exists in gcc 4.7 (r183205). The fault was introduced in gcc-linaro-4.6-2011.09. I've set it to low priority as it is a ftbfs, there is a work-around, and the fault exists upstream. ** Changed in: gcc-linaro Status: New = Triaged ** Changed in: gcc-linaro Importance: Undecided = Low -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
** Tags added: armel armhf precise -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
I can reproduce this on precise (armel armhf). ubuntu@panda2:~/test$ gcc -c -o mp.o mp.c -O3 -funroll-loops /tmp/ccSVzO5N.s: Assembler messages: /tmp/ccSVzO5N.s:202: Error: branch out of range /tmp/ccSVzO5N.s:4145: Error: branch out of range ubuntu@panda2:~/test$ gcc -c -o mp.o mp.c -O3 -funroll-loops -marm ubuntu@panda2:~/test$ ** Changed in: gcc-4.6 (Ubuntu) Status: New = Confirmed ** Changed in: gcc-4.6 (Ubuntu) Importance: Undecided = Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
** Also affects: gcc-linaro Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/gcc-linaro/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
** Attachment added: Example problematic file https://bugs.launchpad.net/bugs/926855/+attachment/2714685/+files/mp.c -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 926855] Re: [ARMhf] gcc produces assembler it can't compile
The file compiles with -O3 -funroll-loops -marm (someone suggested I try) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/926855 Title: [ARMhf] gcc produces assembler it can't compile To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/926855/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs