[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-sparse
Subject:    Lots of sparse bugfixes lately..
From:       Linus Torvalds <torvalds () osdl ! org>
Date:       2004-05-29 5:29:19
Message-ID: Pine.LNX.4.58.0405282219220.1648 () ppc970 ! osdl ! org
[Download RAW message or body]


Al Viro has been playing with sparse on the kernel tree, and was goot at
generating these small snippets of code to show particular bugs. Which got
me a lot more motivated, so in the last few days I've been fixing a _ton_
of type and expression tree problems, and sparse really does a lot better
at things that it totally fell down on before (even when it got the type
right, it often didn't actually get the expression tree right).

As one particular example, multi-dimensional arrays actually work now,
with

	int arr[2][3][4];

	int n(int a, int b, int c)
	{
	        return arr[a][b][c];
	}

actually generating not just the correct type, but the correct expression 
tree and thus linearization

	ep 0x4002600c: n
	   sym: 0x4003b3ac a
	   sym: 0x4003b49c b
	   sym: 0x4003b58c c

	bb: 0x40069018
	        %r1 <- arr
	        %r2 <- a
	        load %r3 <- [%r2]
	        %r4 <- 48
	        %r5 <- mul  %r3, %r4
	        %r6 <- add  %r1, %r5
	        %r7 <- b
	        load %r8 <- [%r7]
	        %r9 <- 16
	        %r10 <- mul  %r8, %r9
	        %r11 <- add  %r6, %r10
	        %r12 <- c
	        load %r13 <- [%r12]
	        %r14 <- 4
	        %r15 <- mul  %r13, %r14
	        %r16 <- add  %r11, %r15
	        load %r17 <- [%r16]
	        ret %r17

which is a lot better than what it did just a few days ago.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic