This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bad generation of jmp r/m32 with offset
- To: Joseph Kain <joseph at 3dfx dot com>
- Subject: Re: Bad generation of jmp r/m32 with offset
- From: Horst von Brand <vonbrand at pincoya dot inf dot utfsm dot cl>
- Date: Mon, 17 Jan 2000 16:52:19 -0300
- cc: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
Joseph Kain <joseph@3dfx.com> said:
> Here is a description of the bug. gcc 2.95.2 produces the wrong asm for
> the dispatch function. The dispatch function looks like this:
> void
> dispatch (int *i)
> {
> /* Pop frame pointer */
> asm ( "pop %ebp");
> asm ( "jmp %0"
> : /* no outputs */
> : "m" (info.context->procs.test)
> );
> }
This is broken. gcc is allowed to move the asm()s around, as there is no
explicit dependency. Also, %ebp is off-limits.
[...]
> With GNU as version 2.9.1 (BFD 2.9.1.0.24) the following warning is issued
> for
> the jump instruction.
> Warning: warning: missing prefix `*' in absolute indirect address,
> maybe misassembled!
> However it correctly assembles the jump as
> FF6004 (JMP r/m32)
Right. You should have written something more like:
void
dispatch (int *i)
{
/* Pop frame pointer */
asm ( "pop %ebp
jmp *%0"
: /* no outputs */
: "m" (info.context->procs.test)
);
}
OTOH, AFAIU this is just doing the same as:
#define dispatch(unused) (info.context->procs.test)()
> GNU as version 2.9.5 (BFD 2.9.5.0.22) issues no warning but instead
> assembles
> the jump incorectly as:
> FF6804 (JMP FAR mem)
>
> Although it is the behavior of the assembler that has changed I
> believe this is a bug in gcc as it is emiting the wrong assembly.
gcc is just emiting what you gave it in the asm(), it does not look at
what is in there, except for interpolating %<digit>s. You did not supply
the missing '*'.
PS: Repeating the same in HTML and as tar.bz2 isn't useful.
--
Dr. Horst H. von Brand mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513