#2050 Wrong type in argument

closed-fixed
Erik Petrich
8
2013-05-25
2012-06-22
No

For the attached example, sdcc makes the second argument 16-bits wide, even though it should be 32 bits.

We thus put less arguments on the stack before the call than we take from the stack after the call.

For some ports, such as. the z80-related ones this results in an assertion failure during compilation.
For other ports, such as the hc08-related ones it results in wrong code being generated silently:

_recv_broadcast:
;test.c:12: printf("", (1000L * latency) / RTIMER_ARCH_SECOND);
clra
psha
clra
psha
lda #__str_0
psha
lda #>__str_0
psha
jsr _printf
ais #6
rts

The attached source code has been created by reducing some code from the Contiki OS.

Philipp

Discussion

  • Code to reproduce the issue

     
    Attachments
  • Erik Petrich
    Erik Petrich
    2012-09-07

    • labels: --> common target code generation
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     
  • Erik Petrich
    Erik Petrich
    2012-09-07

    Fixed in revision #8088