This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/26187] New: computed goto code does not produce jumps


When compiling the test case below, the assembly output shows jmps through eax
to the destination pointer, p, for the functions goto0 and goto2 (which contain
zero and two expressions that take the address of a label).  In function goto1,
which only takes the address of one label, there is no jmp instruction
generated.  The test case originally assigned the label addresses to void *
auto variables, but I removed those while simplifying the test.

I've been able to reproduce this problem on powerpc-linux-gnu also, so it
appears to be target independent.

Compile with gcc -S foo.c and examine foo.s.

extern int printf (const char *format, ...);
int x;

void goto0 (void *p)
{
  goto *p;
}

void goto1 (void *p)
{
  &&label;
  goto *p;
 label:
  x = 0;
}

void goto2 (void *p)
{
  &&label1;
  &&label2;
  goto *p;
 label1:
 label2:
  x = 0;
}


-- 
           Summary: computed goto code does not produce jumps
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bje at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26187


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]