static

Where do I find the assembly that creates a static variable in the .data section of my C program?

删除回忆录丶 提交于 2020-11-28 01:41:44
问题 First time poster. 2nd year CS student. I am exploring the creation of static variables in the .data section of the Virtual Address Space in the context of a C source->GCC compilation->Linux execution environment. C program is test.c int main() { register int i = 0; register int sum = 0; static int staticVar[10] = {1,2,3,4,5,6,7,8,9,-1}; Loop: sum = sum + staticVar[i]; //optimized away i = i+1; if(i != 10) goto Loop; return 0; } Asking GDB to ' disass /m ' reveals that there is no code for