https://bugs.llvm.org/show_bug.cgi?id=39446

            Bug ID: 39446
           Summary: Stack parameter push order incorrect
           Product: libraries
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AVR
          Assignee: unassignedb...@nondot.org
          Reporter: tetsuya.o...@dsn.rohm.co.jp
                CC: llvm-bugs@lists.llvm.org

Created attachment 21037
  --> https://bugs.llvm.org/attachment.cgi?id=21037&action=edit
test code for reproduction

If optimize level is -O1, the order of pushing the last parameter and the
second parameter from last into stack is reversed. It leads incorrect result.

Reproduction procedure is to run the command below, where test.c is the
attached file.
clang --target=avr -O1 test.c -S -o test.S

In test.c, the main function calls function f with parameters
0,1,2,3,4,5,6,7,8,9,10 and 11.
But in test.S, the parameter pushing sequence is like below.
ldi     r24, 10
push    r24
ldi     r24, 11
ldi     r25, 0
push    r25
push    r24
ldi     r24, 9
ldi     r25, 0

I think it supposed to push 11, 10 then 9. But it pushes 10, 11 then 9.

Can anyone fix this problem?
Thank you.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to