This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/82088] New: Implicit conversion "const char *x=" to "const char x[sizeof(...)]="
- From: "dilyan.palauzov at aegee dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 03 Sep 2017 08:58:18 +0000
- Subject: [Bug c/82088] New: Implicit conversion "const char *x=" to "const char x[sizeof(...)]="
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82088
Bug ID: 82088
Summary: Implicit conversion "const char *x=" to "const char
x[sizeof(...)]="
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dilyan.palauzov at aegee dot org
Target Milestone: ---
$ cat a.c
const char * const a = "ABCD";
const char b[5] = "EFGH";
$ gcc -O3 -o a.o -c a.c && nm a.o
0000000000000008 R a
0000000000000000 R b
$ gcc -fPIC -O3 -o a.o -c a.c && nm a.o
0000000000000000 D a
0000000000000000 R b
Why doesn't gcc for PIC convert implicitly "const char *x=" to "const char
x[sizeof(...)]=" in order to create more read-only data?