On Mon, 13 Jan 2003 15:28:45 EST, "Richard B. Johnson" said:
> void foo(int len)
> {
> char use[0x100];
> char bar[len];
> }
>
> In the case of 'use', the compiler subtracts (0x100 * sizeof(char))
> from the current stack value and uses that as the location for 'use'.
> In the case of 'bar' the compiler subtracts (len * sizeof(char))
> from the current stack value and uses that as the location for 'bar'.
One or the other of these is missing a -0x100 for the location...
void foo (int len1, unsigned int len2)
{
char bar[0x100];
char baz[len1];
char quux[len2];
char moby[8];
}
And moby[6] is *where*? ;) Bonus points for getting this right if
compiled with -fvomit-stack-pointer. <evil grin> ;)
-- Valdis Kletnieks Computer Systems Senior Engineer Virginia Tech
--==_Exmh_940296840P Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Exmh version 2.5 07/13/2001
iD8DBQE+IyTwcC3lWbTT17ARAgVkAJ4j+0gy8PNzlYM8wf4W5a9QBauXawCeLGmD ogwFuvto53ER2FIn2USpYBg= =uYKB -----END PGP SIGNATURE-----
--==_Exmh_940296840P-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/