diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2013-03-30 10:19:02 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2013-03-30 10:19:02 +0000 |
commit | 01446eb82c798ed19f8930dd3470f9d77522c22e (patch) | |
tree | 2268fa99cea63797dc549729fa965505d884280a /gcc/testsuite | |
parent | 032951216cf00d9609fbba89186331bd7b4d9efd (diff) | |
download | gcc-01446eb82c798ed19f8930dd3470f9d77522c22e.zip gcc-01446eb82c798ed19f8930dd3470f9d77522c22e.tar.gz gcc-01446eb82c798ed19f8930dd3470f9d77522c22e.tar.bz2 |
trans-expr.c (build_memcmp_call): New function.
2013-03-30 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-30 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.
From-SVN: r197261
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gfortran.dg/character_comparison_3.f90 | 3 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/character_comparison_5.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/character_comparison_9.f90 | 16 |
3 files changed, 19 insertions, 2 deletions
diff --git a/gcc/testsuite/gfortran.dg/character_comparison_3.f90 b/gcc/testsuite/gfortran.dg/character_comparison_3.f90 index dbcdbef..c5acace 100644 --- a/gcc/testsuite/gfortran.dg/character_comparison_3.f90 +++ b/gcc/testsuite/gfortran.dg/character_comparison_3.f90 @@ -25,6 +25,7 @@ program main if (c(:k3) == c(:k44)) call abort end program main -! { dg-final { scan-tree-dump-times "gfortran_compare_string" 8 "original" } } +! { dg-final { scan-tree-dump-times "gfortran_compare_string" 6 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_memcmp" 2 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/character_comparison_5.f90 b/gcc/testsuite/gfortran.dg/character_comparison_5.f90 index b9ad921..08af59a 100644 --- a/gcc/testsuite/gfortran.dg/character_comparison_5.f90 +++ b/gcc/testsuite/gfortran.dg/character_comparison_5.f90 @@ -16,6 +16,6 @@ program main end program main ! { dg-final { scan-tree-dump-times "gfortran_concat_string" 0 "original" } } -! { dg-final { scan-tree-dump-times "gfortran_compare_string" 2 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_memcmp" 2 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/character_comparison_9.f90 b/gcc/testsuite/gfortran.dg/character_comparison_9.f90 new file mode 100644 index 0000000..9d17b3c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/character_comparison_9.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fdump-tree-original" } +program main + character (len=2) :: a, b + character (kind=4,len=4) :: c,d + a = 'ab' + b = 'aa' + if (a < b) call abort + c = 4_"aaaa" + d = 4_"aaab" + if (c == d) call abort + if (c > d) call abort +end program main +! { dg-final { scan-tree-dump-times "_gfortran_compare_string_char4" 1 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_memcmp" 2 "original" } } +! { dg-final { cleanup-tree-dump "original" } } |