erroneous "non-constant expression" error

2005-06-23 Thread Zefram
$ uname -a
Linux treache.rous.org 2.4.19-686 #1 Mon Nov 18 23:59:03 EST 2002 i686 GNU/Linux
$ as --version
GNU assembler 2.15
Copyright 2002 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i386-linux'.
$ dpkg -l binutils
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name   VersionDescription
+++-==-==-
ii  binutils   2.15-6 The GNU assembler, linker and binary utiliti
$ md5sum t.s   # t.s is included as an attachment to this message
812b0e954fb19ac7f460f570cbdd85bd  t.s
$ as t.s
t.s: Assembler messages:
t.s:55: Error: non-constant expression in ".if" statement
$

The expression in the .if is most definitely constant, and the assembler
had no problem with 43 preceding similar expressions.  This bug is
sensitive to the precise sequence of macro calls: changing the order or
adding or removing calls can make the error message occur on a different
line -- possibly several lines -- or not occur at all.  My real code has
about 450 of these macro calls (it's building a string table), and each
time I change it there's about 50% chance that this problem will occur.

-zefram
.macro str STRING
.long [EMAIL PROTECTED]@start
[EMAIL PROTECTED]:
.ascii "\STRING"
[EMAIL PROTECTED]:
.iflt ([EMAIL PROTECTED] - [EMAIL PROTECTED]) - 2
.endif
.p2align 2, 0
.endm
str "aaa"
str "aa"
str "aa"
str "aaa"
str "aa"
str ""
str "aa"
str "aa"
str "aa"
str "aa"
str "a"
str "aa"
str "aa"
str "a"
str "aa"
str "aaa"
str "aaa"
str "aa"
.long 0
str "aa"
str "aa"
str ""
str ""
str "aaa"
str "aaa"
str "aa"
str ""
str "aa"
str "aa"
str "a"
str "aa"
.long 0
str ""
str "a"
str "aa"
str ""
str ""
str ""
str ""
str "aa"
str "aa"
str "aa"
str "aa"
str "aaa"
str "aaa"
str "aa"
___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils


Re: erroneous "non-constant expression" error

2005-06-26 Thread Zefram
Alan Modra wrote:
>Incidentally, I don't see how the code you posted could
>cause this to happen since the .p2align ought to cause a new frag to be
>started, but I do know that this sort of problem can happen.  A
>workaround is to align at the start of your macro.

Aligning at the start of the macro does not fix it, but it does change
where the problem occurs.  This is not too surprising, since at the
beginning of the macro it's already aligned from the previous macro call.
Is there any mechanism to explicitly start a new frag?  Or is there a
way for me to predict the end of the frag so that I can avoid it?

>http://sources.redhat.com/bugzilla/show_bug.cgi?id=997

Ah, that mentions the listing option making a difference.  I discovered
that but forgot to mention it.

-zefram


___
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils