public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: ms@siroyan.com
To: gcc-gnats@gcc.gnu.org
Subject: c/4986: c-common.c, combine_strings () broken for wchar_t == 8 bits
Date: Mon, 03 Dec 2001 03:26:00 -0000	[thread overview]
Message-ID: <20011203111812.12427.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2001-12-03 11:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-03  3:26 ms [this message]
2002-02-26 18:07 rodrigc
2002-05-22  5:22 neil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011203111812.12427.qmail@sources.redhat.com \
    --to=ms@siroyan.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).