This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18666] New: Conversion of floating point into bit-fields
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Nov 2004 00:32:52 -0000
- Subject: [Bug c/18666] New: Conversion of floating point into bit-fields
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Is
/* { dg-do run } */
/* { dg-options "-std=c99 -pedantic-errors } */
struct A { unsigned int i : 1; } a;
extern void abort (void);
int
main (void)
{
a.i = 16.0;
if (a.i != 0)
abort ();
return 0;
}
a valid test or not? This worked with 3.4.x and earlier, but doesn't any
longer. The question is mainly if the type of a.i for the 6.3.1.4/1 purposes
is unsigned int (in this case it would be well-defined, 16 is representable
in unsigned int and storing 16 into unsigned int i : 1 bitfield is defined),
or if the type is integer type with precision 1.
--
Summary: Conversion of floating point into bit-fields
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
CC: aoliva at redhat dot com,gcc-bugs at gcc dot gnu dot
org,joseph at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18666