This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/18129] New: -fwritable-strings doesn't work


struct S { char *a, *b; };

extern void foo (struct S *);

int
main ()
{
  struct S s[] = {
    {"ABCDEFGH0123", "T"},
    {"ABCDEFGH4567", "T"},
    {"ABCDEFGH89ZYX", "T"},
    {"IJK012", "T"},
    {"IJK345", "T"},
    {"IJK678", "T"},
    {"IJKLMN", "T"},
    {"IJKOPQ", "T"},
    {0, 0}
  };

  foo (s);
  return 0;
}

at -O2 -fwritable-strings results in 33 .data strings (one is "", so 32), while
the program has just 16 - everything is duplicated and only one copy is used.

With more strings in the table, the result is sometimes unlinkable due to
undefined .LCxxx symbols.

I'm very well aware that -fwritable-strings is deprecated, but either it should
be killed already in GCC 3.4.x, or it should work.

-- 
           Summary: -fwritable-strings doesn't work
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: x86_64-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18129


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]