This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
constant string changed
- From: Phung Nguyen <nhphung at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 6 Oct 2010 21:59:29 +0700
- Subject: constant string changed
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