Dear all,

When porting GCC on xc16x, I met a problem with a constant string. The
following is the C code:
#include "stdio.h"

int main () {
        
        printf ("c\n");
}
And the following is the generated assembly:
        .xc16x

        .section .rodata

.LC0:
        .ascii "c\0"
        .section .text
        .align 1
        .global _main
_main:
         mov  [-r0],r1
         mov  r1,r0
        
        mov r8,#SOF:.LC0
        calla cc_UC,_puts
         mov  r1,[r0+]
ret

where there is no '\n' in the constant string .LC0 any more. However,
when I change the string into "%c\n" (with a character passed), the
constant string .LC0 becomes .ascii "c\12\0"

Is there any idea about this kind of problem? Where did I got the mistake?

Best regards,
Phung

Reply via email to