Re: Sparse crash when mixing int and enum in ternary operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 09, 2010 at 08:06:23PM +0100, Kamil Dudka wrote:
> On Tuesday 09 of March 2010 19:35:19 Pavel Roskin wrote:
> > I removed the outside conditional, and sparse would still crash on this:
> >
> > crypto_has_alg(alg, type, mask ?: CRYPTO_ALG_TYPE_MASK);
> >
> > but not on this:
> >
> > crypto_has_alg(alg, type, mask ? mask: CRYPTO_ALG_TYPE_MASK);
> >
> > Apparently, the "?:" notation is confusing sparse now.
> 
> To be frank, I've never seen that notation before.  From what I understand, 
> the variants above should be equivalent with each other, right?

Yes, except that the first variant would not evaluate "mask" twice, even
if it consisted of an expression with side effects.  See
http://gcc.gnu.org/onlinedocs/gcc/Conditionals.html .

(When I go to look up something in the GCC manual, more often than not I
end up in Chapter 6, "Extensions to the C Language Family". :) )

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux