Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 229459 - useless warning using anonymous bitfield
Summary: useless warning using anonymous bitfield
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 5
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-21 10:31 UTC by Roland McGrath
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-02-21 14:29:36 UTC


Attachments (Terms of Use)
test function to compile (deleted)
2007-02-21 10:31 UTC, Roland McGrath
no flags Details
Patch that fixes the bug by silencing the warning (deleted)
2007-03-05 07:35 UTC, Alexandre Oliva
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
GNU Compiler Collection 30913 None None None Never

Description Roland McGrath 2007-02-21 10:31:39 UTC
Description of problem:


Version-Release number of selected component (if applicable):
gcc-4.1.1-51.fc5

How reproducible:
100%

Steps to Reproduce:
1.gcc -O2 -Wall -S uninit-anon-bitfield.c
2.
3.
  
Actual results:

uninit-anon-bitfield.c: In function 'foo':
uninit-anon-bitfield.c:18: warning: 'tmp.<U48fc>' is used uninitialized in this
function

Expected results:

No warning, or at least a warning without a bogus field name.

Additional info:

In the case of an anonymous bitfield used for padding, there is no way the field
could be initialized.  There can be no harm from copying an uninitialized value
there, unless the target were part of a union that could access those bits in
another way.  At the very least, the warning is confusing because it names the
field with an internal identifier.  But really, there should be no warning when
there is no way to avoid it.

Comment 1 Roland McGrath 2007-02-21 10:31:40 UTC
Created attachment 148471 [details]
test function to compile

Comment 2 Jakub Jelinek 2007-02-21 14:29:36 UTC
A SRA bug.  Tracking this upstream, as it affects upstream 4.1/4.2/4.3 as well.

Comment 3 Alexandre Oliva 2007-03-05 07:35:11 UTC
Created attachment 149247 [details]
Patch that fixes the bug by silencing the warning

It is simple enough to silence the warning.  Optimizing the code generated by
the compiler when the bitfields are scalarized is much harder, not only in
general (http://gcc.gnu.org/PR22156), but also for padding bitfields,
considering that padding bits *must* be copied unless the entire byte is a
padding byte (6.2.6.1/6 in C99-TC2).


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