From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13892 invoked by alias); 3 Dec 2001 11:26:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 13852 invoked by uid 71); 3 Dec 2001 11:26:01 -0000 Resent-Date: 3 Dec 2001 11:26:01 -0000 Resent-Message-ID: <20011203112601.13851.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, ms@siroyan.com Received:(qmail 12428 invoked by uid 61); 3 Dec 2001 11:18:12 -0000 Message-Id:<20011203111812.12427.qmail@sources.redhat.com> Date: Mon, 03 Dec 2001 03:26:00 -0000 From: ms@siroyan.com Reply-To: ms@siroyan.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: c/4986: c-common.c, combine_strings () broken for wchar_t == 8 bits X-SW-Source: 2001-12/txt/msg00215.txt.bz2 List-Id: >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: