All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: linux-sparse@vger.kernel.org
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Subject: sparse: Why test-parse shows "+=" as a store?
Date: Sun, 26 Apr 2009 16:52:42 -0400	[thread overview]
Message-ID: <49F4C99A.7020208@garzik.org> (raw)


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
> 


             reply	other threads:[~2009-04-26 20:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-26 20:52 Jeff Garzik [this message]
2009-04-27  6:04 ` sparse: Why test-parse shows "+=" as a store? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49F4C99A.7020208@garzik.org \
    --to=jeff@garzik.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.