This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix regex compile_range, kill sparc64 warnings


Hi!

TRANSLATE casts to (char), so we cannot directly use it as index into
collseq array. This has shown up on Alpha and Sparc64 as segfault (because
the index was promoted to (int), not (long), but did not work properly on
32bit arches either.
Also, while building glibc on sparc64 I came accross some warnings...
(will need to give the 64bit glibc some testing still though, right now it
seems at least 64bit gcc works with it).

2000-09-14  Jakub Jelinek  <jakub@redhat.com>

	* posix/regex.c (compile_range): Cast collseq index to unsigned char
	to avoid accessing data before collseq.
	* sysdeps/sparc/fpu/bits/mathinline.h (__unordered_v9cmp): Avoid
	pasting strings together.

--- libc/posix/regex.c.jj	Mon Aug 14 08:47:38 2000
+++ libc/posix/regex.c	Thu Sep 14 09:58:37 2000
@@ -3531,11 +3531,11 @@ compile_range (range_start_char, p_ptr, 
   collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
 						 _NL_COLLATE_COLLSEQMB);
 
-  start_colseq = collseq[TRANSLATE (range_start_char)];
-  end_colseq = collseq[TRANSLATE (p[0])];
+  start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
+  end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
   for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
     {
-      unsigned int this_colseq = collseq[TRANSLATE (this_char)];
+      unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
 
       if (start_colseq <= this_colseq && this_colseq <= end_colseq)
 	{
--- libc/sysdeps/sparc/fpu/bits/mathinline.h.jj	Tue Jul 18 10:31:50 2000
+++ libc/sysdeps/sparc/fpu/bits/mathinline.h	Thu Sep 14 09:40:45 2000
@@ -1,7 +1,7 @@
 /* Inline math functions for SPARC.
    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
+   Contributed by Jakub Jelinek <jakub@redhat.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -62,13 +62,13 @@
       if (sizeof(x) == 4 && sizeof(y) == 4)				      \
 	{								      \
 	  float __x = (x); float __y = (y);				      \
-	  __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" ## op ## "\t%%fcc3,1,%0"	      \
+	  __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
 		  : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");	      \
 	}								      \
       else if (sizeof(x) <= 8 && sizeof(y) <= 8)			      \
 	{								      \
 	  double __x = (x); double __y = (y);				      \
-	  __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" ## op ## "\t%%fcc3,1,%0"	      \
+	  __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
 		  : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");	      \
 	}								      \
       else								      \

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]