public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/53842] New: avr second write to volatile register gets dropped
@ 2012-07-03 19:03 jim at jtan dot com
2012-07-04 9:27 ` [Bug target/53842] " rguenth at gcc dot gnu.org
2012-07-04 15:08 ` jim at jtan dot com
0 siblings, 2 replies; 3+ messages in thread
From: jim at jtan dot com @ 2012-07-03 19:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53842
Bug #: 53842
Summary: avr second write to volatile register gets dropped
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jim@jtan.com
Hi,
I'm seeing volatile writes get dropped with avr-gcc 4.7.0 (as packaged in
Debian). This didn't happen with 4.5.3. Example:
------------
$ cat test.c
#define SPDR (*(volatile char *)(0x2e + 0x20))
#define SPSR (*(volatile char *)(0x2d + 0x20))
static inline char transfer(char tx) {
SPDR = tx;
while (!(SPSR & 0x80)) continue;
return SPDR;
}
void foo(void) {
transfer(0xff);
//asm("":::"memory");
transfer(0xff);
}
$ avr-gcc -c -mmcu=at90usb1287 -O1 test.c -o test.o
$ avr-objdump avr-objdump -d test.o
test.o: file format elf32-avr
Disassembly of section .text:
00000000 <foo>:
0: 8f ef ldi r24, 0xFF ; 255
2: 8e bd out 0x2e, r24 ; 46
4: 0d b4 in r0, 0x2d ; 45
6: 07 fe sbrs r0, 7
8: 00 c0 rjmp .+0 ; 0xa <foo+0xa>
a: 8e b5 in r24, 0x2e ; 46
c: 0d b4 in r0, 0x2d ; 45
e: 07 fe sbrs r0, 7
10: 00 c0 rjmp .+0 ; 0x12 <foo+0x12>
12: 8e b5 in r24, 0x2e ; 46
14: 08 95 ret
------------
Note only one "out" there. If I compile that same code on 4.5.3, or uncomment
that memory barrier and compile on 4.7.0, I get the correct code:
------------
0: 8f ef ldi r24, 0xFF ; 255
2: 8e bd out 0x2e, r24 ; 46
4: 0d b4 in r0, 0x2d ; 45
6: 07 fe sbrs r0, 7
8: 00 c0 rjmp .+0 ; 0xa <foo+0xa>
a: 8e b5 in r24, 0x2e ; 46
c: 8f ef ldi r24, 0xFF ; 255
e: 8e bd out 0x2e, r24 ; 46
10: 0d b4 in r0, 0x2d ; 45
12: 07 fe sbrs r0, 7
14: 00 c0 rjmp .+0 ; 0x16 <foo+0x16>
16: 8e b5 in r24, 0x2e ; 46
18: 08 95 ret
-------------
This seems similar to pr53085, but that bug was listed as existing on 4.5 as
well, while this one seems to be a regression.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/53842] avr second write to volatile register gets dropped
2012-07-03 19:03 [Bug target/53842] New: avr second write to volatile register gets dropped jim at jtan dot com
@ 2012-07-04 9:27 ` rguenth at gcc dot gnu.org
2012-07-04 15:08 ` jim at jtan dot com
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-04 9:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53842
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2012-07-04
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-04 09:26:55 UTC ---
I belive this has been fixed for 4.7.1, please double-check.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug target/53842] avr second write to volatile register gets dropped
2012-07-03 19:03 [Bug target/53842] New: avr second write to volatile register gets dropped jim at jtan dot com
2012-07-04 9:27 ` [Bug target/53842] " rguenth at gcc dot gnu.org
@ 2012-07-04 15:08 ` jim at jtan dot com
1 sibling, 0 replies; 3+ messages in thread
From: jim at jtan dot com @ 2012-07-04 15:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53842
jim at jtan dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Known to work| |4.7.1
Resolution| |FIXED
Known to fail| |4.7.0
--- Comment #2 from jim at jtan dot com 2012-07-04 15:08:03 UTC ---
You're right, 4.7.1 looks fine. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-04 15:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03 19:03 [Bug target/53842] New: avr second write to volatile register gets dropped jim at jtan dot com
2012-07-04 9:27 ` [Bug target/53842] " rguenth at gcc dot gnu.org
2012-07-04 15:08 ` jim at jtan dot com
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 read-only IMAP folder(s) and NNTP newsgroup(s).