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
>Originator:     Ulrich Drepper
>Release:        gcc version 2.97 20001208 (experimental)
Linux x86
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:

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

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).
gcc -S y.c

Content-Type: application/octet-stream; name="y.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="y.c"


More information about the Gcc-bugs mailing list