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?

Reply via email to