why not optimize static local variables
Hi, I've recently been working on static local variables in C. I would like to ask about some questions about that. For example, for the following program, void foo() { static int x = 0; x++; } int main() { foo(); } After optimization with the -O3 -flto option, the entire program will look something like this: int main() { x_foo++; } The question I want to ask is, why not optimize the 'x_foo++' line of code out? Because its scope will only be in foo, and it will not be read at all for the entire program. Is it because it is stored in the global data area? Or are there other security issues? Thanks Hanke Zhang
gcc-13-20231007 is now available
Snapshot gcc-13-20231007 is now available on https://gcc.gnu.org/pub/gcc/snapshots/13-20231007/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 13 git branch with the following options: git://gcc.gnu.org/git/gcc.git branch releases/gcc-13 revision add2afa9e25f1776fdfbeb1b99fd1efcf850f91f You'll find: gcc-13-20231007.tar.xz Complete GCC SHA256=1769946861777585db174aac0e4c9993a1e62e04a29e80aa119981632c68c369 SHA1=44aabe0f255cf03eeb18b29820aeb19824ed10f6 Diffs from 13-20230930 are available in the diffs/ subdirectory. When a particular snapshot is ready for public consumption the LATEST-13 link is updated and a message is sent to the gcc list. Please do not use a snapshot before it has been announced that way.