Skip to contentSkip to conversation

ppcfix.diff

PATCH [email protected] 4 participants 6 messages Nov 29, 2004

lore
Share & tools
lore
#0 lore raw

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)

arch/ppc/syslib/open_pic.c +2 -1
@@ -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);
 	}
Signature · 4 lines
--
Hu Gang / Steve
Linux Registered User 204016
GPG Public Key: http://soulinfo.com/~hugang/hugang.asc
#1 lore raw
Quoted 4 lines

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

Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
#2 lore raw
Quoted 6 lines · Jan Engelhardt
Quoted 4 lines

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.

Quoted 1 line

Jan Engelhardt

cu
Adrian

Signature · 4 lines
       "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
#3 lore raw
In reply to [email protected]

arch/ppc/syslib/open_pic.c static void openpic_mapirq(u_int irq, cp · line 780

Quoted 4 lines · On Mon, Nov 29, 2004 at 11:40:41PM +0800, [email protected] wrote:
arch/ppc/syslib/open_pic.c +2 -1
 	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)} };
#4 lore raw
Quoted 7 lines

arch/ppc/syslib/open_pic.c static void openpic_mapirq(u_int irq, cp · line 780

Quoted 4 lines
arch/ppc/syslib/open_pic.c +2 -1
 	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

Signature · 2 lines
Gesellschaft für Wissenschaftliche Datenverarbeitung
Am Fassberg, 37077 Göttingen, www.gwdg.de
#5 lore raw
Quoted 9 lines · Jan Engelhardt
Quoted 7 lines

arch/ppc/syslib/open_pic.c static void openpic_mapirq(u_int irq, cp · line 780

Quoted 4 lines
arch/ppc/syslib/open_pic.c +2 -1
 	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.