[Bug c/33901] New: assumes target of a const pointer is read-only
rmh at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Oct 25 20:17:00 GMT 2007
Given the following code:
main ()
{
const char *foo = 0;
*foo = 0;
}
gcc will refuse to compile it with:
$ echo "main () { const char *foo = 0; *foo = 0; }" | gcc -x c -c - -o
/dev/null
<stdin>: In function ‘main’:
<stdin>:1: error: assignment of read-only location
Sure, foo is read-only, but *foo is just a memory location; one should be able
to write to it.
--
Summary: assumes target of a const pointer is read-only
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmh at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33901
More information about the Gcc-bugs
mailing list