From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJmjL-0004j9-JD for qemu-devel@nongnu.org; Fri, 06 Feb 2015 12:30:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJmjH-0003iL-At for qemu-devel@nongnu.org; Fri, 06 Feb 2015 12:30:11 -0500 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:56459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJmjH-0003i8-76 for qemu-devel@nongnu.org; Fri, 06 Feb 2015 12:30:07 -0500 Received: by mail-qg0-f46.google.com with SMTP id j5so12260845qga.5 for ; Fri, 06 Feb 2015 09:30:06 -0800 (PST) Sender: Richard Henderson Message-ID: <54D4FA1A.20104@twiddle.net> Date: Fri, 06 Feb 2015 09:30:02 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1423233250-15853-1-git-send-email-peter.maydell@linaro.org> <54D4E9CD.3020707@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/4] target-arm: fix various clang UB sanitizer warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Patch Tracking On 02/06/2015 08:43 AM, Peter Maydell wrote: > On 6 February 2015 at 16:20, Richard Henderson wrote: >> It should be enough to simply add the unsigned suffix to the integers as they >> are, forcing the underlying type to be unsigned. > > I can't see anything in the C99 spec that justifies this > as a fix... In fact, 6.7.2.2 para 3 says > "The identifiers in an enumerator list are declared as > constants that have type int", which sounds to me like it > means "if you have enum { foo = ..., }; then 'foo' must > have (signed) integer type even if the representation > of the enum type is unsigned". Hum. True, despite the talk in para 4 about the compatible type of the enumeration. Which is why my test worked with a variable of enum type, but doesn't work with one of the enum members. Oh well. r~