This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/4986: c-common.c, combine_strings () broken for wchar_t == 8 bits



>Number:         4986
>Category:       c
>Synopsis:       c-common.c, combine_strings () broken for wchar_t == 8 bits
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 03 03:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     ms@siroyan.com
>Release:        3.0.2
>Organization:
>Environment:
Sparc Solaris
>Description:
c-common.c, combine_Strings () will attempt to widen
char  to wchar_t if any of the strings being combined are
wide. The widening loop hardcodes host wchar_t sizes 
equivalent to short and int, if wchar_t is setup with only 8
bits it will fall through into the (int *) branch potentially
causing a non aligned access bus error.

>How-To-Repeat:

>Fix:
I'm working around this with the following patch:

***************
*** 279,285 ****
  	      int i;
  	      for (i = 0; i < len; i++)
  		{
! 		  if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT)
  		    ((short *) q)[i] = TREE_STRING_POINTER (t)[i];
  		  else
  		    ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
--- 431,439 ----
  	      int i;
  	      for (i = 0; i < len; i++)
  		{
! 		  if (WCHAR_TYPE_SIZE == HOST_BITS_PER_CHAR)
! 		    ((char *) q)[i] = TREE_STRING_POINTER (t)[i];
! 		  else if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT)
  		    ((short *) q)[i] = TREE_STRING_POINTER (t)[i];
  		  else
  		    ((int *) q)[i] = TREE_STRING_POINTER (t)[i];
***************
>Release-Note:
>Audit-Trail:
>Unformatted:


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