Description of problem: The attachment contains the code | struct BlackListQuery query = { | .ip = reinterpret_cast(struct in_addr const *)(msg->data.arp_tpa), | .mac = 0, | }; When compiling with | gcc -g3 -O3 -mcpu=i686 -c ip-sentinel.i it generates 830: fc cld 831: 31 c0 xor %eax,%eax 833: 8d 7b 1c lea 0x1c(%ebx),%edi 836: 89 bd d8 ed ff ff mov %edi,0xffffedd8(%ebp) 83c: b9 05 00 00 00 mov $0x5,%ecx 841: 8d 53 26 lea 0x26(%ebx),%edx 844: 89 95 60 ee ff ff mov %edx,0xffffee60(%ebp) 84a: 8d bd 58 ee ff ff lea 0xffffee58(%ebp),%edi 850: f3 ab repz stos %eax,%es:(%edi) &query is at 0xffffee58 (relative to %ebp), query.ip at 0xffffee60. The 'repz stos' runs 4 times and deletes all bytes between 0xffffee58 and 0xffffee68 -- inclusive the value which was just assigned at *0x844. Version-Release number of selected component (if applicable): gcc-3.3.2-1
Created attachment 96200 [details] ip-sentinel.i.bz2
This seems to be because the structure members are themselves const. GCC marks the memory with RTX_UNCHANGING_P, but such memory is by other optimization passes assumed to be written only once. GCC should probably just kill the RTX_UNCHANGING_P flags if it decides to memset the whole structure because it is too sparse. For the time being, you are best with removing the const keywords.
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg00236.html
An errata has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2004-142.html