[PATCH] for SIGSEGV, compilation error in gcc 4.6

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Thu Feb 10 15:33:00 GMT 2011

On Thu, Feb 10, 2011 at 11:56:52PM +0900, jojelino wrote:
>i am sorry for extra line feed. corrected.
>requesting review.

>Index: winsup/cygwin/dcrt0.cc
>RCS file: /cvs/src/src/winsup/cygwin/dcrt0.cc,v
>retrieving revision 1.390
>diff -u -r1.390 dcrt0.cc
>--- winsup/cygwin/dcrt0.cc	26 Dec 2010 21:11:37 -0000	1.390
>+++ winsup/cygwin/dcrt0.cc	10 Feb 2011 14:46:04 -0000
>@@ -1034,7 +1034,7 @@
>   sig_dispatch_pending (true);
> }
>-void __stdcall
>+void __stdcall __attribute__ ((regparm (1), noreturn))
> do_exit (int status)
> {
>   syscall_printf ("do_exit (%d), exit_state %d", status, exit_state);
>@@ -1198,7 +1198,7 @@
> }

I really don't understand how this can fix a SIGSEGV.  If do_exit is
not being produced as a stdcall function then it should be producing
a link error since a stdcall function is decorated with the number of
bytes that need to be removed from the stack, e.g., do_exit@4.

Also a function declared with regparm() should either 1) do the right
thing if it's missing a regparm() in the definition or 2) complain at
compile time.

It is not a bad thing to make the declarations and definitions coincide
but I don't understand what is being fixed here.


More information about the Cygwin-patches mailing list