This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Re: g++/linker bug on cygwin1.1.0 (win32)


On 8 May 2000, Marat Boshernitsan wrote:

> 
> Hello,
> 
> I've hit upon an obscure g++/linker bug on Cygwin1.1.0 which causes the
> resulting executable to have "call 0x0" instructions in a few places
> instead of proper calls.  The attached testcase (together with the
> Makefile) demonstrates the problem: just do make and run one of the
> resulting "bug*" executables to get a runtime error.
> 
> Few points of interest:
> 
> - the test case is fairly obscure, but it is distilled from a much
> larger system.
> 
> - if the return type of the argument type of "void* __stdcall
> I_RpcAllocate(unsigned int);" declaration in dlltest.cc are modified in
> any way the problem goes away.  (This declaration is not random: I
> actually pulled it out of one of the cygwin header files -- rpcdcep.h --
> after several hours of chasing this down).

It's caused by a misfeature/bug in the C++ parser. The following
declarations can cause bizarre behaviour in your code (and *very*
hard to track down as you've found out):
  
  void * __stdcall foo ();

whereas the following works fine:

  void __stdcall * foo ();
  __stdcall void * foo ();


Cygwin 1.1.0 has the workarounds for this bug in the system headers
(ole.h, rpcdcep.h and winsock.h).

This has been one of the weirdest bug to track since it causes bad
code, and as soon as you change the order of includes or object files,
it magically goes away!

See the following for a testcase that shows the problem:

   Linkname: (C++) parser bug in handling fn attributes
   URL: http://gcc.gnu.org/ml/gcc-bugs/1999-11n/msg00084.html

Regards,
Mumit



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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