https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100496

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Yes, this is the same as pr100417.  Until something better is available a
workaround is to set the element whose address is passed to the const pointer,
like so:

extern void XmlUtf8Convert(char* p_start, const char* const p_end);

void findEncoding() {
  char buf[128];
  char *p = buf;
  buf[sizeof buf - 1] = 0;   // avoid -Wmaybe-uninitialized below
  XmlUtf8Convert(p, p + sizeof(buf) - 1);
}

Another alternative is to add an optimizer barrier (asm volatile("": :
:"memory")).

*** This bug has been marked as a duplicate of bug 100417 ***

Reply via email to