Re: ppcfix.diff

From: Al Viro
Date: Mon Nov 29 2004 - 13:15:35 EST


On Mon, Nov 29, 2004 at 06:44:14PM +0100, Jan Engelhardt wrote:
> >> if (!cpus_empty(keepmask)) {
> >> - cpumask_t irqdest = { .bits[0] = openpic_read(&ISR[irq]->Destination) };
> >> + cpumask_t irqdest;
> >> + irqdest.bits[0] = openpic_read(&ISR[irq]->Destination);
> >
> >Not an equivalent replacement. The former means "set irqdest.bits[0] to
> ><expression> and set the rest of fields/array elements in them to zero/null".
>
> Really? I thought zero'ing only happens for static storage.

Two different issues - behaviour when no initializer is given and behaviour
when initializer does not cover everything.

IOW,

static int a1[4]; /* all zeroes, since it's non-auto */
static int a2[4] = {1,0,0,0} /* 1 0 0 0, we have initialized them all */
static int a3[4] = {1} /* 1 0 0 0, missing members are zeroed */
void f(void)
{
int b1[4]; /* undefined contents */
int b2[4] = {1,0,0,0} /* 1 0 0 0, we have initialized them all */
int b3[4] = {1} /* 1 0 0 0, missing members are zeroed */

C99 6.7.8(21) and 6.7.8(10) deal with "not covers everything" and
"no initializer at all" resp.
-
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/