------- Comment #3 from vda dot linux at googlemail dot com 2007-01-28 17:25
-------
Sorry! Bug in the testcase, should be "char *p".
I remember that string literals are special - they decay to "const char *" OR
to "char*" depending on context. In this context, it should decay to "char*",
and it does - gcc doesn't complain "assingment of const to non-const", the bug
is that gcc placed "str" in ro section.
char *p;
int main() {
p = "str";
return 0;
}
/*
.file "t.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "str"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
movl $.LC0, p
xorl %eax, %eax
leave
ret
.size main, .-main
.comm p,4,4
.ident "GCC: (GNU) 4.1.1"
.section .note.GNU-stack,"",@progbits
*/
--
vda dot linux at googlemail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30622