Skip to contentSkip to conversation

: you can't use p and p++ without a secuence point

PATCH New Juan Quintela 1 participant 1 message Dec 19, 2002 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : you can't use p and p++ without a secuence point

Hi
using p & p++ without a sequence point in the middle is undefined behaviour. Once there fix the casts also. and change == to = as normally == means identity, not asignation :(

Later, Juan.

Index: arch/mips/lib/dump_tlb.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/lib/dump_tlb.c,v retrieving revision 1.8.2.6

mips/lib/dump_tlb.c +2 -4
diff -u -r1.8.2.6 dump_tlb.c
@@ -225,9 +226,7 @@
 
 	for(i=0;i<8;i++)
 	{
-		printk("*%08lx == %08lx, ",
-		       (unsigned long)p, (unsigned long)*p++);
-		printk("*%08lx == %08lx\n",
-		       (unsigned long)p, (unsigned long)*p++);
+		printk("*%8p = %08lx, ", p, *p); p++;
+		printk("*%8p = %08lx\n", p, *p); p++;
 	}
 }
Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy