Hi,
I think I've got an optimizer bug producing a bzero of data that doesn't need initialization.
Whether Ray has a ctor defined or not gcc wipes the memory 257 words for no reason. What does have an effect is if you call the ctor of just Ray it doesn't clear the data.
One would expect none of the PODs to be inited unless explicitly done so in the code
I'm guessing there's some kind of a bzero optimization where padding and non-inited PODs can be cleared along with several fields that need to be. I'm guessing that this optimization is broken somehow.
I'm getting this on gcc 4.6.0 debug and O3.
struct Ray{
unsigned n;g
int u[0x100];
//Ray() : n() {}
};
struct Ray2: Ray {};
void makeRay(void*v){
new(v)Ray2();
}
g++ -ftemplate-depth-512 -O3 -finline-functions -Wno-inline -Wall -pthread -m32 -g -march=core2
00006ca0 <makeRay(void*)>:
6ca0: 57 push %edi
6ca1: 8b 54 24 08 mov 0x8(%esp),%edx
6ca5: 85 d2 test %edx,%edx
6ca7: 74 0b je 6cb4 <makeRay(void*)+0x14>
6ca9: b9 33 00 00 00 mov $0x33,%ecx
6cae: 31 c0 xor %eax,%eax
6cb0: 89 d7 mov %edx,%edi
6cb2: f3 ab rep stos %eax,%es:(%edi)
6cb4: 5f pop %edi
6cb5: c3 ret
Chris
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]