This is the mail archive of the
glibc-bugs-regex@sourceware.org
mailing list for the glibc project.
[Bug regex/1278] regex undefined behavior with shifting past word length
- From: "paolo dot bonzini at lu dot unisi dot ch" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs-regex at sources dot redhat dot com
- Date: 2 Sep 2005 06:17:15 -0000
- Subject: [Bug regex/1278] regex undefined behavior with shifting past word length
- References: <20050831193645.1278.eggert@gnu.org>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From paolo dot bonzini at lu dot unisi dot ch 2005-09-02 06:17 -------
Subject: Re: regex undefined behavior with shifting past
word length
>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.
>
>
So you want ~0u, but not -1.
Paolo
--
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.