public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/26187]  New: computed goto code does not produce jumps
@ 2006-02-09  0:29 bje at gcc dot gnu dot org
  2006-02-09  0:32 ` [Bug middle-end/26187] " pinskia at gcc dot gnu dot org
  2006-02-09  0:38 ` bje at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: bje at gcc dot gnu dot org @ 2006-02-09  0:29 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/26187] computed goto code does not produce jumps
  2006-02-09  0:29 [Bug middle-end/26187] New: computed goto code does not produce jumps bje at gcc dot gnu dot org
@ 2006-02-09  0:32 ` pinskia at gcc dot gnu dot org
  2006-02-09  0:38 ` bje at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09  0:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-02-09 00:32 -------
computed goto's can only goto local labels or gotos in the contained functions.
 I don't see the bug here really.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/26187] computed goto code does not produce jumps
  2006-02-09  0:29 [Bug middle-end/26187] New: computed goto code does not produce jumps bje at gcc dot gnu dot org
  2006-02-09  0:32 ` [Bug middle-end/26187] " pinskia at gcc dot gnu dot org
@ 2006-02-09  0:38 ` bje at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: bje at gcc dot gnu dot org @ 2006-02-09  0:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bje at gcc dot gnu dot org  2006-02-09 00:38 -------
Thanks; I guess I misunderstood the semantics of computed gotos.  On closer
inspection of the GCC manual,

  "You may not use this mechanism to jump to code in a different function.
   If you do that, totally unpredictable things will happen.  The best way
   to avoid this is to store the label address only in automatic variables
   and never pass it as an argument."


-- 

bje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug middle-end/26187] computed goto code does not produce jumps
       [not found] <bug-26187-4@http.gcc.gnu.org/bugzilla/>
@ 2024-03-16 17:54 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-16 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu.org

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 31727 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-16 17:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-09  0:29 [Bug middle-end/26187] New: computed goto code does not produce jumps bje at gcc dot gnu dot org
2006-02-09  0:32 ` [Bug middle-end/26187] " pinskia at gcc dot gnu dot org
2006-02-09  0:38 ` bje at gcc dot gnu dot org
     [not found] <bug-26187-4@http.gcc.gnu.org/bugzilla/>
2024-03-16 17:54 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).