linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse: Why test-parse shows "+=" as a store?
@ 2009-04-26 20:52 Jeff Garzik
  2009-04-27  6:04 ` Christopher Li
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Garzik @ 2009-04-26 20:52 UTC (permalink / raw)
  To: linux-sparse; +Cc: Al Viro


Consider this testcase:

int bloo = 0;

void inc_bloo(void)
{
	bloo += 2;
}

int get_bloo(void)
{
	return bloo;
}

test-parse (and its derivatives, compile-i386 and s2l-gen) parse the 
above "bloo += 2" as a simple assignment "bloo = 2".

Any idea why?  I'm not sure if this is a tree-walker bug or something 
from the parsing.  The test-parse output is below...

	Jeff




> hello.c:2:5: warning: symbol 'bloo' was not declared. Should it be static?
> hello.c:4:6: warning: symbol 'inc_bloo' was not declared. Should it be static?
> hello.c:9:5: warning: symbol 'get_bloo' was not declared. Should it be static?
> 
> .align 4
> int [signed] [addressable] [toplevel] [assigned] bloo
>  = 
> 	movi.32		v1,$0
> , 
> void extern [addressable] [toplevel] inc_bloo( ... )
> 	movi.32		v2,$2
> 	movi.32		v3,$bloo
> 	st.32		v2,[v3]
> .L0x7f0b0b4a2030:
> 	addi.32		v4,vFP,$offsetof(return:0x7f0b0b4a2030)
> 	ld.-1		v5,[v4]
> 	mov.-1		retval,5
> 	ret
> , 
> .align 4
> int extern [signed] [addressable] [toplevel] get_bloo( ... )
> 	movi.32		v6,$bloo
> 	ld.32		v7,[v6]
> 	addi.32		v8,vFP,$offsetof(return:0x7f0b0b4a23b0)
> 	st.32		v7,[v8]
> 	ret		(0x7f0b0b4a23b0)
> .L0x7f0b0b4a23b0:
> 	addi.32		v9,vFP,$offsetof(return:0x7f0b0b4a23b0)
> 	ld.32		v10,[v9]
> 	mov.32		retval,10
> 	ret
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-28  0:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-26 20:52 sparse: Why test-parse shows "+=" as a store? Jeff Garzik
2009-04-27  6:04 ` Christopher Li
2009-04-27 10:28   ` Jeff Garzik
2009-04-27 17:45     ` Christopher Li
2009-04-27 17:53       ` Christopher Li
2009-04-27 22:57       ` Jeff Garzik
2009-04-27 23:39         ` Christopher Li
2009-04-28  0:24           ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).