[patch, fortran] Use memcmp() for string comparison for constant-length kind=1 strings

Thomas Koenig tkoenig@netcologne.de
Mon Mar 25 17:01:00 GMT 2013

Hello world,

this patch uses memcpy() directly when comparing two kind=1 strings of
equal and constant lengths.  The test case modification depends
on the previous patch at


for setting the string lengths for substrings.

Regression-tested.  No extra test case because the original test
cases have to be modified to avoid failure, and test the new
feature.  OK for trunk after committing the patch above?

2013-03-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

         * trans-expr.c (build_memcmp_call):  New function.
         (gfc_build_compare_string):  If the kind=1 strings to be
         compared have constant and equal lengths, use

2013-03-25  Thomas Koenig  <tkoenig@gcc.gnu.org>

         * gfortran.dg/character_comparison_3.f90:  Adjust for use of memcmp
         for constant and equal string lengths.
         * gfortran.dg/character_comparison_5.f90:  Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 2755 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130325/5f8432b8/attachment.bin>

More information about the Gcc-patches mailing list