about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--linuxthreads/ChangeLog4
-rw-r--r--posix/regex.c19
3 files changed, 23 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ecd9ce4223..406710870b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,13 @@
 2001-02-08  Ulrich Drepper  <drepper@redhat.com>
 
+	* posix/regex.c: Fix alignment problem.
+	Patch by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
 	* sysdeps/alpha/strrchr.S: Little optimization.
 	Patch by Richard Henderson <rth@redhat.com>.
 
 	* sysdeps/alpha/alphaev67/strrchr.S: New file.
-	Contributed by Rick Gorton <rick.gorton@alpha-processor.com>..
+	Contributed by Rick Gorton <rick.gorton@alpha-processor.com>.
 
 2001-02-08  kaz Kojima  <kkojima@rr.iij4u.or.jp>
 
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index c071ad6e66..3e8abb8e1a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,7 @@
+2001-02-08  kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/unix/sysv/linux/sh/pt-initfini.c: New file.
+
 2001-02-06  Martin Schwidefsky  <schwidefsky@de.ibm.com>
 
 	* sysdeps/unix/sysv/linux/s390/pt-initfini.c: New file.
diff --git a/posix/regex.c b/posix/regex.c
index ec25642e31..63f072afac 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -62,7 +62,7 @@
 # define US_CHAR_TYPE wchar_t/* unsigned character type */
 # define COMPILED_BUFFER_VAR wc_buffer
 # define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
-# define CHAR_CLASS_SIZE (sizeof(wctype_t)/sizeof(CHAR_TYPE)+1)
+# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_TYPE)+1)
 # define PUT_CHAR(c) \
   do {									      \
     if (MC_CUR_MAX == 1)						      \
@@ -2807,6 +2807,8 @@ regex_compile (pattern, size, syntax, bufp)
                     if (c == ':' && *p == ']')
                       {
 			wctype_t wt;
+			uintptr_t alignedp;
+
 			/* Query the character class as wctype_t.  */
 			wt = IS_CHAR_CLASS (str);
 			if (wt == 0)
@@ -2824,9 +2826,14 @@ regex_compile (pattern, size, syntax, bufp)
                         b += CHAR_CLASS_SIZE;
 			/* Move data which follow character classes
 			    not to violate the data.  */
-                        insert_space(CHAR_CLASS_SIZE, laststart + 6, b - 1);
+                        insert_space(CHAR_CLASS_SIZE,
+				     laststart + 6 + laststart[1],
+				     b - 1);
+			alignedp = ((uintptr_t)(laststart + 6 + laststart[1])
+				    + __alignof__(wctype_t) - 1)
+			  	    & ~(uintptr_t)(__alignof__(wctype_t) - 1);
 			/* Store the character class.  */
-                        *((wctype_t*)(laststart + 6)) = wt;
+                        *((wctype_t*)alignedp) = wt;
                         /* Update length of char_classes */
                         laststart[1] += CHAR_CLASS_SIZE;
 
@@ -6001,7 +6008,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
             /* match with char_class?  */
 	    for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE)
 	      {
-		wctype_t wctype = *((wctype_t*)workp);
+		wctype_t wctype;
+		uintptr_t alignedp = ((uintptr_t)workp
+				      + __alignof__(wctype_t) - 1)
+		  		      & ~(uintptr_t)(__alignof__(wctype_t) - 1);
+		wctype = *((wctype_t*)alignedp);
 		workp += CHAR_CLASS_SIZE;
 		if (iswctype((wint_t)c, wctype))
 		  goto char_set_matched;