From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21721 invoked by alias); 1 Sep 2005 22:29:36 -0000 Mailing-List: contact glibc-bugs-regex-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-regex-owner@sources.redhat.com Received: (qmail 21698 invoked by uid 48); 1 Sep 2005 22:29:30 -0000 Date: Thu, 01 Sep 2005 22:29:00 -0000 Message-ID: <20050901222930.21697.qmail@sourceware.org> From: "eggert at gnu dot org" To: glibc-bugs-regex@sources.redhat.com In-Reply-To: <20050831193645.1278.eggert@gnu.org> References: <20050831193645.1278.eggert@gnu.org> Reply-To: sourceware-bugzilla@sources.redhat.com Subject: [Bug regex/1278] regex undefined behavior with shifting past word length X-Bugzilla-Reason: CC X-SW-Source: 2005-09/txt/msg00015.txt.bz2 List-Id: ------- Additional Comments From eggert at gnu dot org 2005-09-01 22:29 ------- The last hunk is purely for ports to ones' complement and signed-magnitude hosts. It has no effect in the normal case. For example, on a one's complement host, ~0 has the numeric value zero, i.e., ~0 == 0. Also, ~0 is of type int. When ~0 is converted to unsigned int, it is converted by value, not by bit-pattern. (The C Standard requires this.) Hence ((unsigned) ~0) is equivalent to ((unsigned) 0), which in turn is equivalent to 0u, which is zero. The same problem occurs with signed-magnitude hosts. It also occurs with unsigned short int (the type being used here). Admittedly this is a minor point since such hosts are rare, but it's easy to do portably so we might as well do it that way. -- http://sources.redhat.com/bugzilla/show_bug.cgi?id=1278 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.