Re: Bitfield conversion bug in 4.2?

2007-03-19 Thread Jim Wilson

Eric Lemings wrote:

Is this a bug or new behavior?  If the latter, what is this attributed
to?


FYI gcc-bugs isn't the best place to ask questions, as it is mostly used 
for output from our bug database.


I'm not a C++ expert, so I'm not the right person to say for sure, but 
this looks like an accidental bug to me.  There were patches added to 
change the bitfield type representation, the 
is_bitfield_expr_with_lowered_type change, which is for PR 26534.  I 
believe these patches have an error.


It looks to me like the bug is in standard_conversion in cp/calls.c at 
these lines

  if (bitfield_type)
from = strip_top_quals (bitfield_type);
This sets from, but fails to set fcode, resulting in an inconsistency. 
In this case, fcode is INTEGER_TYPE and from is now an enumeral type 
after originally being an integer type.  This causes a failure further 
down in the tcode == BOOLEAN_TYPE code where we fail to match the 
conditions due to this inconsistency.


I'd suggest opening a bug report.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com


Bitfield conversion bug in 4.2?

2007-03-16 Thread Eric Lemings
Hi,
 
The following code compiles fine in GCC 4.1.
 
enum E { e };
struct S {
  E v:5;
};
S s;
int main() { if (!s.v) return 0; }

In 4.2 (20070307), it gives the following error:

test.cpp: In function 'int main()':
test02.cpp:6: error: could not convert 's.S::v' to 'bool'
test02.cpp:6: error: in arguument to unary !

Is this a bug or new behavior?  If the latter, what is this attributed
to?
 
Thanks,
Eric.