New compile error on ARM

Bug #1166628 reported by Snark
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
binutils
Confirmed
Medium
binutils (Ubuntu)
Fix Released
Undecided
Matthias Klose

Bug Description

I have the following compile error with gcc-4.7 version 4.7.2-23ubuntu2:

/bin/bash ../libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" gcc -std=gnu99 -c -DHAVE_CONFIG_H -O2 -fomit-frame-pointer -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo udiv | sed 's/_$//'` -I. -I.. `test -f 'udiv.asm' || echo './'`udiv.asm
libtool: compile: ../mpn/m4-ccas --m4=m4 gcc -std=gnu99 -c -DHAVE_CONFIG_H -O2 -fomit-frame-pointer -D__GMP_WITHIN_GMP -I.. -DOPERATION_udiv -I. -I.. udiv.asm -fPIC -DPIC -o .libs/udiv.o
m4 -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_udiv -DPIC udiv.asm >tmp-udiv.s
 gcc -std=gnu99 -c -DHAVE_CONFIG_H -O2 -fomit-frame-pointer -D__GMP_WITHIN_GMP -I.. -DOPERATION_udiv -I. -I.. tmp-udiv.s -fPIC -DPIC -o .libs/udiv.o
tmp-udiv.s: Assembler messages:
tmp-udiv.s:83: Error: ARM register expected -- `str r1,[ r0 ]'
tmp-udiv.s:134: Error: ARM register expected -- `str r1,[ r0 ]'
make[2]: *** [udiv.lo] Error 1

The problem occurs trying to compile either mpir (upstream 2.6.0 or upstream trunk), or the ubuntu source package for libgmp10. The source file triggering the problem is in fact mostly the same.

I think I can blame gcc rather than that source file because it used to compile when my toshiba ac100 was still running precise, then quantal.

Revision history for this message
In , Khem Raj (khem-raj) wrote :

We are now regressing on arm and getting the above error after this commit
This happens on both master as well as 2.23 branch

commit 65faec7cb829c58b20a5f26ee2908ac35165fc58
Author: Roland McGrath <email address hidden>
Date: Tue Nov 20 17:58:28 2012 +0000

    gas/
        * config/tc-arm.c (arm_symbol_chars): New variable.
        * config/tc-arm.h (tc_symbol_chars): New macro, defined to that.

    gas/testsuite/
        * gas/arm/macro-pld.s: New file.
        * gas/arm/macro-pld.d: New file.

Test case is below

a.s
====

.text
str r1,[ r0 ]

$ ./gas/as-new a.s
/home/kraj/a.s: Assembler messages:
/home/kraj/a.s:2: Error: ARM register expected -- `str r1,[ r0 ]'

If I remove spaces before and after r0 the errors goes away. Testcase works well on 2.22 branch and without the above commit.

Revision history for this message
In , Mikpe (mikpe) wrote :

The problem of whitespace before the closing bracket is PR14987, fixed on head but not on 2.23 branch where it is a regression from the 2.23.1 release.

The problem of whitespace after the opening bracket is not fixed on head, but a patch similar to PR14987's fixes it on both head and 2.23 branch:

diff -u -p -r1.550 tc-arm.c
--- binutils-2.24-2013-01-05/gas/config/tc-arm.c 2 Jan 2013 13:38:55 -0000 1.550
+++ binutils-2.24-2013-01-05/gas/config/tc-arm.c 5 Jan 2013 15:23:42 -0000
@@ -5168,6 +5168,9 @@ parse_address_main (char **str, int i, i
       return PARSE_OPERAND_SUCCESS;
     }

+ /* PR gas/14887: Allow for whitespace after the opening bracket. */
+ skip_whitespace (p);
+
   if ((reg = arm_reg_parse (&p, REG_TYPE_RN)) == FAIL)
     {
       inst.error = _(reg_expected_msgs[REG_TYPE_RN]);

Revision history for this message
In , Cvs-commit (cvs-commit) wrote :

CVSROOT: /cvs/src
Module name: src
Changes by: <email address hidden> 2013-01-07 12:49:12

Modified files:
 gas : ChangeLog
 gas/config : tc-arm.c
 gas/testsuite : ChangeLog
 gas/testsuite/gas/arm: neon-ldst-es.s

Log message:
 PR gas/14887
 * config/tc-arm.c (skip_past_char): Skip whitespace before the
 anticipated character.
 * config/tc-arm.c (parse_address_main): Delete skip of whitespace
 here as it is no longer needed.

 PR gas/14887
 * gas/arm/neon-ldst-es.s: Add more whitespace.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4898&r2=1.4899
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&r1=1.550&r2=1.551
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2165&r2=1.2166
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/neon-ldst-es.s.diff?cvsroot=src&r1=1.4&r2=1.5

Revision history for this message
In , Nickc (nickc) wrote :

Hi Guys,

  Mikael's patch works, but there are other cases where extra whitespace can cause bogux syntax errors. So I have extended his patch by adding a call to skip_whitespace() inside skip_past_char(). This seems to take care of all of the cases that I could find. If any more examples of bogus whitespace syntax errors do show up, feel free to reopen this issue.

Cheers
  Nick

Revision history for this message
In , Jqhn (jqhn) wrote :

This very same problem is now a regression in the 2.23.2 release, was not an issue for 2.23.1.

Revision history for this message
Adam Conrad (adconrad) wrote :

Pretty sure this is a binutils bug, the same one worked around in https://launchpad.net/ubuntu/+source/gmp/2%3A5.0.5%2Bdfsg-2ubuntu3

affects: gcc-4.7 (Ubuntu) → binutils (Ubuntu)
Adam Conrad (adconrad)
Changed in binutils (Ubuntu):
assignee: nobody → Matthias Klose (doko)
Changed in binutils:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package binutils - 2.23.2-2ubuntu1

---------------
binutils (2.23.2-2ubuntu1) raring; urgency=low

  * Merge with Debian; remaining changes:
    - Build from upstream sources.
    - Build binutils-static and binutils-static-udeb packages.
    - Add simple rebuild autopkgtest.

binutils (2.23.2-2) experimental; urgency=low

  * Add support for Cortex-A53 / Cortex-A57.
  * Fix PR gas/14887 and PR gas/14987, gas syntax errors on ARM.
    LP: #1166628.
 -- Matthias Klose <email address hidden> Tue, 16 Apr 2013 02:57:24 +0200

Changed in binutils (Ubuntu):
status: New → Fix Released
Revision history for this message
Snark (julien-puydt) wrote :

Is it fixed upstream too?

Revision history for this message
Snark (julien-puydt) wrote :

(the question is so I know if it's useful to push changes around the ARM asm issues upstream or not)

Revision history for this message
Adam Conrad (adconrad) wrote :

The fixes applied were from upstream trunk, so it will be fixed when upstream does a releases including those (see the upstream bug linked).

Revision history for this message
In , Cvs-commit (cvs-commit) wrote :

CVSROOT: /cvs/src
Module name: src
Branch: binutils-2_23-branch
Changes by: <email address hidden> 2013-06-24 23:36:17

Modified files:
 gas : ChangeLog
 gas/config : tc-arm.c
 gas/testsuite : ChangeLog
 gas/testsuite/gas/arm: neon-ldst-es.s

Log message:
 gas/
 PR gas/14887
 * config/tc-arm.c (skip_past_char): Skip whitespace before the
 anticipated character.
 * config/tc-arm.c (parse_address_main): Delete skip of whitespace
 here as it is no longer needed.

 gas/testsuite/
 PR gas/14887
 * gas/arm/neon-ldst-es.s: Add more whitespace.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.4769.2.32&r2=1.4769.2.33
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/config/tc-arm.c.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.523.2.8&r2=1.523.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.2057.2.33&r2=1.2057.2.34
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/arm/neon-ldst-es.s.diff?cvsroot=src&only_with_tag=binutils-2_23-branch&r1=1.3.8.1&r2=1.3.8.2

Revision history for this message
In , E-roland (e-roland) wrote :

I've put that fix on the 2.23 branch too now.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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