[Bug target/53842] New: avr second write to volatile register gets dropped

2012-07-03 Thread jim at jtan dot com
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: unassig...@gcc.gnu.org
ReportedBy: j...@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:

 :
   0:   8f ef   ldi r24, 0xFF   ; 255
   2:   8e bd   out 0x2e, r24   ; 46
   4:   0d b4   in  r0, 0x2d; 45
   6:   07 fe   sbrsr0, 7
   8:   00 c0   rjmp.+0 ; 0xa 
   a:   8e b5   in  r24, 0x2e   ; 46
   c:   0d b4   in  r0, 0x2d; 45
   e:   07 fe   sbrsr0, 7
  10:   00 c0   rjmp.+0 ; 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   sbrsr0, 7
   8:   00 c0   rjmp.+0 ; 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   sbrsr0, 7
  14:   00 c0   rjmp.+0 ; 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.


[Bug target/53842] avr second write to volatile register gets dropped

2012-07-04 Thread jim at jtan dot com
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.


[Bug debug/75194] -flto loses .debug_macro section

2018-06-25 Thread jim at jtan dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75194

--- Comment #5 from jim at jtan dot com ---
Thank you!

[Bug lto/75194] New: -flto loses .debug_macro section

2016-08-12 Thread jim at jtan dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75194

Bug ID: 75194
   Summary: -flto loses .debug_macro section
   Product: gcc
   Version: 5.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jim at jtan dot com
  Target Milestone: ---

With -flto, I can't get "info macros" to work in GDB.  The .debug_macros
section seems to be lost:

$ cat test.c
#define HELLO "hello"
int main() {}
$ gcc -Wall -Wextra -o test1 test.c -ggdb3
$ gcc -Wall -Wextra -o test2 test.c -ggdb3 -flto
$ readelf -WS test1 > 1
$ readelf -WS test2 > 2
$ diff -u 1 2
--- 1   2016-08-12 15:10:04.153446089 -0400
+++ 2   2016-08-12 15:10:07.393523823 -0400
@@ -1,4 +1,4 @@
-There are 37 section headers, starting at offset 0x3398:
+There are 36 section headers, starting at offset 0x1460:

 Section Headers:
   [Nr] Name  TypeAddress  OffSize   ES Flg
Lk Inf Al
@@ -31,14 +31,13 @@
   [26] .bss  NOBITS  00600890 000890 08 00  WA
 0   0  1
   [27] .comment  PROGBITS 000890 25 01  MS
 0   0  1
   [28] .debug_arangesPROGBITS 0008b5 30 00
 0   0  1
-  [29] .debug_info   PROGBITS 0008e5 56 00
 0   0  1
-  [30] .debug_abbrev PROGBITS 00093b 3a 00
 0   0  1
-  [31] .debug_line   PROGBITS 000975 57 00
 0   0  1
-  [32] .debug_strPROGBITS 0009cc 0019b8 01  MS
 0   0  1
-  [33] .debug_macro  PROGBITS 002384 0005f2 00
 0   0  1
-  [34] .shstrtab STRTAB   003239 000159 00
 0   0  1
-  [35] .symtab   SYMTAB   002978 0006c0 18
36  53  8
-  [36] .strtab   STRTAB   003038 000201 00
 0   0  1
+  [29] .debug_info   PROGBITS 0008e5 52 00
 0   0  1
+  [30] .debug_abbrev PROGBITS 000937 37 00
 0   0  1
+  [31] .debug_line   PROGBITS 00096e 39 00
 0   0  1
+  [32] .debug_strPROGBITS 0009a7 e0 01  MS
 0   0  1
+  [33] .shstrtab STRTAB   001312 00014c 00
 0   0  1
+  [34] .symtab   SYMTAB   000a88 000690 18
35  51  8
+  [35] .strtab   STRTAB   001118 0001fa 00
 0   0  1
 Key to Flags:
   W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
   I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)

[Bug lto/75194] -flto loses .debug_macro section

2016-08-13 Thread jim at jtan dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75194

jim at jtan dot com changed:

   What|Removed |Added

Version|5.4.0   |6.1.1

--- Comment #2 from jim at jtan dot com ---
Same result with GCC 6.1.1.