[Patch, fortran] Use memcmp for string comparisons a bit more

Thomas Koenig tkoenig@netcologne.de
Fri Mar 29 21:26:00 GMT 2013


Am 29.03.2013 15:56, schrieb Tobias Burnus:
>
> Thus, how about using memcmp for kind=4 for == and /= only - and for
> kind=1 also for <, > etc.?

OK, there is the updated patch.

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

         * trans-expr.c (build_memcmp_call):  New function.
         (gfc_build_compare_string):  If the strings
         compared have constant and equal lengths and
         the strings are kind=1, or (for kind=4) strings,
         the test is for (in)equality, use memcmp().

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.
         * gfortran.dg/character_comparison_9.f90:  New test.

Regerssion-tested.  OK for trunk?

	Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p4.diff
Type: text/x-patch
Size: 3022 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130329/11326f08/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: character_comparison_9.f90
Type: text/x-fortran
Size: 479 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130329/11326f08/attachment-0001.bin>


More information about the Gcc-patches mailing list