c/1045: asm label for C label misplaced

drepper@redhat.com drepper@redhat.com
Tue Dec 12 00:56:00 GMT 2000


>Number:         1045
>Category:       c
>Synopsis:       asm label for C label misplaced
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 12 00:56:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Drepper
>Release:        gcc version 2.97 20001208 (experimental)
>Organization:
>Environment:
Linux x86
>Description:
For some reason (don't ask) I have to use labels in asms.  This is on x86 and I know who I can make this work (see below).  The code works just fine but the current mainline gcc has some problems.  The code I use is this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void
d (void)
{
  asm ("jmp %P0" : : "i" (&&l));
 l:
}

int
main (void)
{
  d ();
  return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Unfortunately this generates the following code for d:

   9 0000 55                    pushl   %ebp
  10 0001 89E5                  movl    %esp, %ebp
  11                    #APP
  12 0003 EB02                  jmp .L3
  13                    #NO_APP
  14 0005 5D                    popl    %ebp
  15 0006 C3                    ret
  16                    .L3:

Note the position of the label .L3.  If I put another instruction after the label l everything is fine.  It also used to work with previous gcc versions (egcs 1.1.2 is what I tested).
>How-To-Repeat:
gcc -S y.c
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="y.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="y.c"

dm9pZApkICh2b2lkKQp7CiAgYXNtICgiam1wICVQMCIgOiA6ICJpIiAoJiZsKSk7CiBsOgovLyAg
cmV0dXJuOwp9Cg==


More information about the Gcc-bugs mailing list