Bug 110966 - Bad code on filling structures
Summary: Bad code on filling structures
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 1.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2003-11-25 23:19 UTC by Enrico Scholz
Modified: 2007-04-18 16:59 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-05-12 03:40:23 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 23:22 UTC, Enrico Scholz
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:142 normal SHIPPED_LIVE GCC bugfix update 2004-05-11 04:00:00 UTC

Description Enrico Scholz 2003-11-25 23:19:20 UTC
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):


Comment 1 Enrico Scholz 2003-11-25 23:22:19 UTC
Created attachment 96200 [details]

Comment 2 Jakub Jelinek 2003-12-02 15:59:47 UTC
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-12 03:40:24 UTC
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.


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