public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/103673] New: avr-gcc with -mrelax with .balign is buggy
@ 2021-12-12 19:40 therealdragony at gmx dot de
2021-12-12 19:52 ` [Bug other/103673] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: therealdragony at gmx dot de @ 2021-12-12 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103673
Bug ID: 103673
Summary: avr-gcc with -mrelax with .balign is buggy
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: therealdragony at gmx dot de
Target Milestone: ---
Compile the following assembler code with avr-gcc
.rept 300
call test
.endr
ldi ZL,lo8(matrix)
ldi ZH,hi8(matrix)
1:rjmp 1b
test:
ret
.balign 256
matrix:
.byte 1,2,3,4,5
Then look at .lss
250: 06 d0 rcall .+12 ; 0x25e <test>
252: 05 d0 rcall .+10 ; 0x25e <test>
254: 04 d0 rcall .+8 ; 0x25e <test>
256: 03 d0 rcall .+6 ; 0x25e <test>
258: e8 ea ldi r30, 0xA8 ; 168
25a: f2 e0 ldi r31, 0x02 ; 2
25c: ff cf rjmp .-2 ; 0x25c <const_1s_max+0x1dd>
0000025e <test>:
25e: 08 95 ret
...
00000300 <matrix>:
300: 01 02 muls r16, r17
302: 03 04 cpc r0, r3
304: 05 00 .word 0x0005 ; ????
As you can see, the ldi is loading 0x02AB, which is wrong, as the matrix is
(correctly) located at 0x0300.
Compiled via:
#avr-gcc --version
avr-gcc (GCC) 10.2.0
#avr-gcc main.S -o main.elf -Wall -Wextra -std=gnu99 -mmcu=atxmega384c3
-nostartfiles -mrelax -Wl,--no-stubs -Wa,--no-pad-sections
#avr-objdump -DSg main.elf > main.lss
PS: This is my first bug report at all. I'm sorry if it contains formal
mistakes.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-12 19:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12 19:40 [Bug other/103673] New: avr-gcc with -mrelax with .balign is buggy therealdragony at gmx dot de
2021-12-12 19:52 ` [Bug other/103673] " pinskia at gcc dot gnu.org
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).