This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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: detailed comparison of generated code size for GCC and other compilers


Optimizations based on uninitialized variables make me very nervous.
If uninitialized memory reads are transformed into don't-cares, then
checking tools like valgrind will no longer see the UMR (assuming that
the lack of initialization is a bug).

Did I understand that icc does this? It seems like a dangerous practice.

Yes, it looks like icc does this. But so does gcc, see below. There is no "add" in the generated code.


John Regehr


[regehr@babel ~]$ cat undef.c int foo (int x) { int y; return x+y; } [regehr@babel ~]$ current-gcc -O3 -S -o - undef.c -fomit-frame-pointer .file "undef.c" .text .p2align 4,,15 .globl foo .type foo, @function foo: movl 4(%esp), %eax ret .size foo, .-foo .ident "GCC: (GNU) 4.5.0 20091117 (experimental)" .section .note.GNU-stack,"",@progbits


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