[#5928] gas has problems with local labels in LOOP instructions

Document created by Aaronwu Employee on Oct 17, 2013
Version 1Show Document
  • View in full screen mode

[#5928] gas has problems with local labels in LOOP instructions

Submitted By: Robin Getz

Open Date

2010-02-24 09:55:40     Close Date

2010-06-18 13:53:58

Priority:

Medium     Assignee:

Vivi Li

David Gibson

Board:

Custom     Silicon Revision:

-

Resolution:

Fixed     Fixed In Release:

N/A

Processor:

ALL     

Host Operating System:

toolchain rev.:

    kernel rev.:

State:

Closed     Found In Release:

2010R1

Is this bug repeatable?:

yes     

Summary: gas has problems with local labels in LOOP instructions

Details:

 

#include "test.h"

 

        .include "testutils.inc"

 

        start

 

        .macro divide num:req den:req

 

        /* Evaluate given a signed integer dividend and divisor */

        r0 = \num;      /* Dividend, or numerator */

        r1 = \den;      /* Divisor, or denominator */

 

        r0 <<= 1;       /* Left shift dividend by 1 needed for integer division */

        p0 = 15;        /* Evaluate the quotient to 16 bits. */

        divs (r0, r1);  /* Evaluate quotient MSB. Initialize AQ status bit and dividend for the DIVQ loop. */

 

        loop 1f lc0=p0;      /* Evaluate DIVQ p0=15 times. */

loop_begin 1;

        divq (r0, r1);

loop_end 1;

        r0 = r0.l (x);          /* Sign extend the 16-bit quotient to 32bits.  */

                                /* r0 contains the quotient (70/5 = 14)        */

        r1 = (\num / \den);

        CC = r0 == r1

        if !CC jump 2f;

        pass

 

2:

        fail

 

        .endm

 

        divide 70 5

        divide 100 10

        divide 1000 10

 

------------

 

gives me:

 

Compiling tests: divq.s: Assembler messages:

divq.s:33: Error: Invalid expression in LOOP_BEGIN statement.

divq.s:33: Error: Invalid expression in LOOP_END statement.

divq.s:34: Error: Invalid expression in LOOP_BEGIN statement.

divq.s:34: Error: Invalid expression in LOOP_END statement.

divq.s:35: Error: Invalid expression in LOOP_BEGIN statement.

divq.s:35: Error: Invalid expression in LOOP_END statement.

make: *** [divq.s.x] Error 1

make: *** Waiting for unfinished jobs....

 

 

changing it to:

        loop .Lfoo lc0=p0;      /* Evaluate DIVQ p0=15 times. */

loop_begin .Lfoo;

        divq (r0, r1);

loop_end .Lfoo;

        r0 = r0.l (x);

 

divq.s:33: Internal error, aborting at /home/rgetz/blackfin/trunk/toolchain/binutils-2.17/gas/symbols.c line 817 in symbol_remove

Please report this bug.

 

 

Follow-ups

 

--- Mike Frysinger                                           2010-05-27 14:09:45

is that original code correct ?  i dont see it declaring "1:"

anywhere, and the loop_begin/loop_end should be using "1f" or

"1b" and not just "1".

 

--- Robin Getz                                               2010-05-27 18:01:38

It's correct in terms of it should be

 

loop       name lc0=p0;

loop_begin name;         /* place before the first instruction in the loop */

        divq (r0, r1);

loop_end   name;         /* place after the last instruction in the loop */

        r0 = r0.l (x);

 

It's just that names can't be numeric local labels.

 

since the parser turns names into $L$L (local labels)

 

So - I don't think this is a bug.

Or - at least the bug is between the chair and the keyboard.

 

I'll leave this open - since we shouldn't ever get an internal error (that

needs to be tracked down) - we are calling symbol_remove with null or

something...

 

-Robin

 

-Robin

 

--- David Gibson                                             2010-06-08 06:38:45

Fixed this issue, but the fix has caused a regression (6059).

 

--- Sonic Zhang                                              2010-06-18 04:47:44

David,

 

Could you add a test case for this bug under binutility?

 

--- Robin Getz                                               2010-06-18 13:51:16

Things look OK - verified that the old assembler fails on the new test cases,

and the new assembler works.

 

Since I opened things - I'll close it.

 

Thanks

-Robin

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes