Re: [PATCH v2] compiler: prevent dead store elimination

From: Andi Kleen
Date: Tue Mar 02 2010 - 07:17:15 EST


> > + do { \
> > + struct __scrub { typeof(*p) c[n]; }; \
>
> The typeof(*p) suggestion doesn't work. It would require p to always be
> a pointer type with an accurate (for memset) sizeof(*p). In general however
> we'll memset some array described by a void*/size_t pair, and typeof in
> that case is useless. The original'struct __scrub { char c[n]; };' was Ok.

I just suggested it because of the original array name of the macro
and without it it would have only worked for char arrays. With the new
naming it's ok I guess.

It could be made to work with macros and builtin_type_match I guess,
but it would be fairly ugly and not worth it.

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/