ignored 'goto *(void*)' insn.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm wondering if this behavior is a bug or not.  The 
following code generates the output:
  0x8048774
  FINISHED

as opposed to the half-expected
  0xADDR
  REACHED
  FINISHED

(The other half of me expects a seg-fault with ebp
being reset and all.)  The fact is that it just
ignores the goto all together.  There is no jmp
generated between the last two cout's.  And yes, I
know it's not real code...  Any ideas??

# 2 "interp_test.cpp" 2

void* v;

void func( void )
{
    std::cout << "REACHED" << '\n';
    std::cout.flush();
    goto *v;
}

int main( void )
{
    __label__ FINISHED;
    v = &&FINISHED;
    union pf2po { void (*func)(void); void* object; };
    pf2po f;
    f.func = func;
    std::cout << std::hex << "0x" <<
(unsigned)f.object << '\n';
    goto *f.object;
FINISHED:
    std::cout << "FINISHED\n";
}

//////////////////////////////////////////////////////

The exact version of GCC;
  gcc-3.3.2

the system type;
  Linux 2.6.2 #8 SMP Sun Feb 15 00:47:02 EST 2004 i686
  (pentium4 c 800 3.01)

the options given when GCC was configured/built;
  Configured with: ../gcc-3.3.2/configure
--prefix=/usr 
  --enable-languages=c,c++,objc --enable-threads=posix
--enable-__cxa_atexit 
  --enable-clocale=gnu --enable-shared --disable-nls
  Thread model: posix

the complete command line that triggers the bug;
   g++ interp_test.cpp

the compiler output (error messages, warnings, etc.);
   doesn't generate 'jmp' for "goto *f.object;"  (When
a.out is run, the
   following output is generated:
  0x8048774
  FINISHED


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux