[llvm-bugs] [Bug 39446] New: Stack parameter push order incorrect

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 25 23:09:45 PDT 2018


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: unassignedbugs at nondot.org
          Reporter: tetsuya.ooka at dsn.rohm.co.jp
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181026/efde9477/attachment.html>


More information about the llvm-bugs mailing list