What is the gcc option which reorders the variables' address?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Compiling the code below as "gcc -O1 test.c" I obtain the output:
0xbffff958 0xbffff95c 0xbffff960
That is, bytes 59, 5a and 5b are unused.

Instead, compiling it as  "gcc -O2 test.c" I obtain:
0xbffff958 0xbffff95c 0xbffff959
That is, variables are reordered to get a more memory efficient.

My question is: Which GCC option allows variables reordering?

I would like to obtain just variable reordering, not all "-O2"
package; reading in the gcc manual, I singularly tried with all
options in "-O2" but no one reorders the variables.

many thanks,
Leo

***
THE CODE:

#include <stdio.h>

main(int argc, char **argv)
{	
	char a;
	long b;
	char c;

	printf("%p %p %p\n", &a, &b, &c);
}

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux