Re: Option to make unsigned->signed conversion always well-defined?

2011-10-05 Thread Pedro Pedruzzi
int a, unsigned int b) { const unsigned int sum = a + b; return ((a & 0x80) == (b & 0x80)) && ((a & 0x80) != (sum & 0x80)); } But it is not as efficient as yours. -- Pedro Pedruzzi

Re: Option to make unsigned->signed conversion always well-defined?

2011-10-06 Thread Pedro Pedruzzi
lea(%rsi,%rdi,1),%eax 400527: 31 f8 xor%edi,%eax 400529: 31 f7 xor%esi,%edi 40052b: f7 d7 not%edi 40052d: 21 f8 and%edi,%eax 40052f: 25 80 00 00 00 and$0x80,%eax 400534: c3 retq -- Pedro Pedruzzi

Re: Option to make unsigned->signed conversion always well-defined?

2011-10-07 Thread Pedro Pedruzzi
Em 07-10-2011 02:35, Miles Bader escreveu: > Pedro Pedruzzi writes: >> On Thu, Oct 6, 2011 at 11:04 AM, Miles Bader wrote: >>> How about: >>> >>> bool overflowbit2(unsigned int a, unsigned int b) >>> { >>> const unsigned i

Possible missing case for -Wcast-align

2010-04-30 Thread Pedro Pedruzzi
.var); ptr = &str.var; } Is this the expected behavior in this case? I don't think so. And I guess gcc is missing it by trusting the type's (short) alignment requirement instead of the variable's (str.var requires just byte-alignment). Does anyone think this is an is

Re: anonymous struct

2010-05-03 Thread Pedro Pedruzzi
On 03-05-2010 00:47 wuyin wrote: struct T{ int n; }; struct T1{ struct T; } t; t.n=1; Please support this grammar. I believe it _is_ currently supported with -fms-extensions. See: http://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html Regards, -- Pedro Pedruzzi

unexpected warning "comparison of promoted ~unsigned with unsigned warning"

2012-03-06 Thread Pedro Pedruzzi
effect of bug #38341 ? Thanks, -- Pedro Pedruzzi