mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-09 20:44:07 +08:00
re PR libfortran/30525 ([4.2, 4.1 only] character comparisons with padding)
2007-01-21 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/30525 * intrinsics/string_intrinsics.c(compare_string): Make sure that comparisons are done unsigned. 2007-01-21 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/30525 * gfortran.dg/char_comparison_1.f: New test. From-SVN: r121035
This commit is contained in:
parent
7fa49e7be7
commit
bd9431157f
@ -1,3 +1,8 @@
|
|||||||
|
2007-01-21 Thomas Koenig <Thomas.Koenig@online.de>
|
||||||
|
|
||||||
|
PR libfortran/30525
|
||||||
|
* gfortran.dg/char_comparison_1.f: New test.
|
||||||
|
|
||||||
2007-01-21 Ira Rosen <irar@il.ibm.com>
|
2007-01-21 Ira Rosen <irar@il.ibm.com>
|
||||||
|
|
||||||
* gcc.dg/vect/vect-strided-same-dr.c: New test.
|
* gcc.dg/vect/vect-strided-same-dr.c: New test.
|
||||||
|
26
gcc/testsuite/gfortran.dg/char_comparison_1.f
Normal file
26
gcc/testsuite/gfortran.dg/char_comparison_1.f
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
C { dg-do run }
|
||||||
|
C PR 30525 - comparisons with padded spaces were done
|
||||||
|
C signed.
|
||||||
|
program main
|
||||||
|
character*2 c2
|
||||||
|
character*1 c1, c3, c4
|
||||||
|
C
|
||||||
|
C Comparison between char(255) and space padding
|
||||||
|
C
|
||||||
|
c2 = 'a' // char(255)
|
||||||
|
c1 = 'a'
|
||||||
|
if (.not. (c2 .gt. c1)) call abort
|
||||||
|
C
|
||||||
|
C Comparison between char(255) and space
|
||||||
|
C
|
||||||
|
c3 = ' '
|
||||||
|
c4 = char(255)
|
||||||
|
if (.not. (c4 .gt. c3)) call abort
|
||||||
|
|
||||||
|
C
|
||||||
|
C Check constant folding
|
||||||
|
C
|
||||||
|
if (.not. ('a' // char(255) .gt. 'a')) call abort
|
||||||
|
|
||||||
|
if (.not. (char(255) .gt. 'a')) call abort
|
||||||
|
end
|
@ -1,3 +1,9 @@
|
|||||||
|
2007-01-21 Thomas Koenig <Thomas.Koenig@online.de>
|
||||||
|
|
||||||
|
PR libfortran/30525
|
||||||
|
* intrinsics/string_intrinsics.c(compare_string): Make
|
||||||
|
sure that comparisons are done unsigned.
|
||||||
|
|
||||||
2006-12-09 Tobias Burnus <burnus@net-b.de>
|
2006-12-09 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
PR libfortran/30015
|
PR libfortran/30015
|
||||||
|
@ -83,7 +83,7 @@ compare_string (GFC_INTEGER_4 len1, const char * s1,
|
|||||||
GFC_INTEGER_4 len2, const char * s2)
|
GFC_INTEGER_4 len2, const char * s2)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
const char *s;
|
const unsigned char *s;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
res = memcmp (s1, s2, (len1 < len2) ? len1 : len2);
|
res = memcmp (s1, s2, (len1 < len2) ? len1 : len2);
|
||||||
@ -96,13 +96,13 @@ compare_string (GFC_INTEGER_4 len1, const char * s1,
|
|||||||
if (len1 < len2)
|
if (len1 < len2)
|
||||||
{
|
{
|
||||||
len = len2 - len1;
|
len = len2 - len1;
|
||||||
s = &s2[len1];
|
s = (unsigned char *) &s2[len1];
|
||||||
res = -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = len1 - len2;
|
len = len1 - len2;
|
||||||
s = &s1[len2];
|
s = (unsigned char *) &s1[len2];
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user