This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Unsafe strcmp -> memcmp transformation in gcc-3.3
- From: "Hartmut Penner" <HPENNER at de dot ibm dot com>
- To: Roger at www dot eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org, "Ulrich Weigand" <Ulrich dot Weigand at de dot ibm dot com>, "Martin Schwidefsky" <schwidefsky at de dot ibm dot com>
- Date: Thu, 2 Oct 2003 09:13:02 +0200
- Subject: Unsafe strcmp -> memcmp transformation in gcc-3.3
Roger,
on zSeries we hit the bug you fixed for PR10339 (unsafe strcmp
to memcmp transformation)
Scenario:
We had a fixed string right at the end of mapped memory.
A strcmp ("some _string",s) was transformed to a cmpstrsi insn, which was
up to 3.3 on zSeries really what is now (3.4) a cmpmemsi (memcmp). Due to
the memcmp semantic of our implementation of cmpstrsi we did access
over the ending '0' of the string s, enduring a program exception.
I think, this is a serious bug, what you think of backporting your fix for
PR10339
for gcc-3.3 ? In this case we could also backport out 'cmpstr' to 'cmpmem'
for
gcc-3.3
regards, Hartmut