Bug 110966 - Bad code on filling structures
Bad code on filling structures
Status: CLOSED ERRATA
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
1.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-25 18:19 EST by Enrico Scholz
Modified: 2007-04-18 12:59 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-05-11 23:40:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
ip-sentinel.i.bz2 (24.42 KB, application/octet-stream)
2003-11-25 18:22 EST, Enrico Scholz
no flags Details

  None (edit)
Description Enrico Scholz 2003-11-25 18:19:20 EST
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
Comment 1 Enrico Scholz 2003-11-25 18:22:19 EST
Created attachment 96200 [details]
ip-sentinel.i.bz2
Comment 2 Jakub Jelinek 2003-12-02 10:59:47 EST
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.
Comment 4 John Flanagan 2004-05-11 23:40:24 EDT
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

Note You need to log in before you can comment on or make changes to this bug.