This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: makecontext and its arguments


-----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-----


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