2004-11-29 15:42:11

by Hu Gang

[permalink] [raw]
Subject: ppcfix.diff

Hi Andrew Morton:

Please apply this patch, to fix compile error in debian woody.
$gcc -v
Reading specs from /usr/lib/gcc-lib/powerpc-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)

--- 2.6.9-lzf/arch/ppc/syslib/open_pic.c 2004-11-26 12:32:58.000000000 +0800
+++ 2.6.9/arch/ppc/syslib/open_pic.c 2004-11-28 23:16:58.000000000 +0800
@@ -776,7 +776,8 @@ static void openpic_mapirq(u_int irq, cp
if (ISR[irq] == 0)
return;
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);
cpus_and(irqdest, irqdest, keepmask);
cpus_or(physmask, physmask, irqdest);
}
--
--
Hu Gang / Steve
Linux Registered User 204016
GPG Public Key: http://soulinfo.com/~hugang/hugang.asc


2004-11-29 16:44:24

by Jan Engelhardt

[permalink] [raw]
Subject: Re: ppcfix.diff

>Please apply this patch, to fix compile error in debian woody.
>$gcc -v
>Reading specs from /usr/lib/gcc-lib/powerpc-linux/2.95.4/specs
>gcc version 2.95.4 20011002 (Debian prerelease)

Is 2.95.*4* supported, after all?



Jan Engelhardt
--
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, http://www.gwdg.de

2004-11-29 17:05:06

by Adrian Bunk

[permalink] [raw]
Subject: Re: ppcfix.diff

On Mon, Nov 29, 2004 at 05:42:59PM +0100, Jan Engelhardt wrote:
> >Please apply this patch, to fix compile error in debian woody.
> >$gcc -v
> >Reading specs from /usr/lib/gcc-lib/powerpc-linux/2.95.4/specs
> >gcc version 2.95.4 20011002 (Debian prerelease)
>
> Is 2.95.*4* supported, after all?

2.95.4 is the version the post-2.95.3 snapshot of the gcc 2.95
identifies itself. There was no official 2.95.4 and I don't know what is
supported on ppc, but at least on i386, it is supported.

> Jan Engelhardt

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2004-11-29 17:22:58

by Al Viro

[permalink] [raw]
Subject: Re: ppcfix.diff

On Mon, Nov 29, 2004 at 11:40:41PM +0800, [email protected] 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".
The latter leaves everything except irqdest.bits[0] undefined.

Short version of the story: out of
a) cpumask_t irqdest = { .bits[0] = foo() };
b) cpumask_t irqdest = { .bits = {[0] = foo()} };
c) cpumask_t irqdest;
irqdest.bits[0] = foo();
we have
valid C89 OK for 2.95 OK for 3.x valid C99 initializes everything
(a) no no yes yes yes
(b) no yes yes yes yes
(c) yes yes yes yes no

IOW, 2.95 implements only a precursor to C99 initializer syntax and that's
why (a) gives an error. Proper fix is (b) - replace the line in question
with
cpumask_t irqdest = { .bits = {[0] = openpic_read(&ISR[irq]->Destination)} };

2004-11-29 17:45:10

by Jan Engelhardt

[permalink] [raw]
Subject: Re: ppcfix.diff

>> 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.



Jan Engelhardt
--
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, http://www.gwdg.de

2004-11-29 18:12:59

by Al Viro

[permalink] [raw]
Subject: Re: ppcfix.diff

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.