makecontext and its arguments

Ulrich Drepper drepper@redhat.com
Mon Aug 5 14:21:00 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Schwab wrote:

> To which type?  What if the integer is of type __int128 (TImode)?

What has this to do with the problem?

gcc today for x86-64 promotes (signed) char and short to int, unsigned 
char and unsigned short to unsigned.  If a vararg function is marked 
with the new attribute (signed) char, short, int are promoted to long, 
and unsigned char, unsigned short, and unsigned are promoted to unsigned 
long.  This is what happens on all other 64-bit machines.  The compiler 
knows about all the types.

Inside the function (makecontext) we know the parameters are 
long/unsigned long.  You don't use the normal var arg macros with int or 
short or whatever.  The implementor knows about the attribute.

All larger types and pointers and float are left alone.  If you pass 
such a value to makecontext you get what you'd get on other platforms: 
garbage.

- -- 
- ---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9Tuxl2ijCOnn/RHQRAgutAJ9O34hfZIA535QbkRgKN/03H5+nDwCgocaU
wQZDxjBnyViMYCaIdm6n3Nw=
=Q9/Z
-----END PGP SIGNATURE-----



More information about the Libc-hacker mailing list