From patchwork Mon Aug 22 13:57:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 1085402 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7MDvakW020938 for ; Mon, 22 Aug 2011 13:57:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750905Ab1HVN5g (ORCPT ); Mon, 22 Aug 2011 09:57:36 -0400 Received: from filtteri1.pp.htv.fi ([213.243.153.184]:59198 "EHLO filtteri1.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226Ab1HVN5f (ORCPT ); Mon, 22 Aug 2011 09:57:35 -0400 Received: from localhost (localhost [127.0.0.1]) by filtteri1.pp.htv.fi (Postfix) with ESMTP id 9A8C5BFA7; Mon, 22 Aug 2011 16:57:34 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp6.welho.com ([213.243.153.40]) by localhost (filtteri1.pp.htv.fi [213.243.153.184]) (amavisd-new, port 10024) with ESMTP id wJ8pos2oUfW3; Mon, 22 Aug 2011 16:57:34 +0300 (EEST) Received: from localhost.localdomain (cs181136138.pp.htv.fi [82.181.136.138]) by smtp6.welho.com (Postfix) with ESMTP id 482A25BC009; Mon, 22 Aug 2011 16:57:34 +0300 (EEST) From: Pekka Enberg To: linux-sparse@vger.kernel.org Cc: Pekka Enberg , Christopher Li , Jeff Garzik , Linus Torvalds Subject: [PATCH 4/5] sparse, i386: Fix boolean bit size Date: Mon, 22 Aug 2011 16:57:30 +0300 Message-Id: <1314021451-24808-4-git-send-email-penberg@kernel.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314021451-24808-1-git-send-email-penberg@kernel.org> References: <1314021451-24808-1-git-send-email-penberg@kernel.org> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 22 Aug 2011 13:58:07 +0000 (UTC) The value of 'ctype->bit_size' is set to 1 for booleans which confuses the i386 backend: ./compile allocate.c compile: compile-i386.c:1406: emit_binop: Assertion `0' failed. Aborted Looking at the code, we assume that "bit_size / 8" gives a sane result on various places. This patch fixes the problem by bumping bit_size to 8 for booleans. This also makes sizeof(_Bool) return 1 which is consistent with what GCC 4.4.3, for example, does. Cc: Christopher Li Cc: Jeff Garzik Cc: Linus Torvalds Signed-off-by: Pekka Enberg --- target.c | 2 +- validation/sizeof-bool.c | 3 --- 2 files changed, 1 insertions(+), 4 deletions(-) diff --git a/target.c b/target.c index 17b228a..6a535bc 100644 --- a/target.c +++ b/target.c @@ -14,7 +14,7 @@ int max_alignment = 16; /* * Integer data types */ -int bits_in_bool = 1; +int bits_in_bool = 8; int bits_in_char = 8; int bits_in_short = 16; int bits_in_int = 32; diff --git a/validation/sizeof-bool.c b/validation/sizeof-bool.c index 6c68748..31b0585 100644 --- a/validation/sizeof-bool.c +++ b/validation/sizeof-bool.c @@ -4,9 +4,6 @@ static int a(void) } /* * check-name: sizeof(_Bool) is valid - * check-description: sizeof(_Bool) was rejected because _Bool is not an even - * number of bytes * check-error-start -sizeof-bool.c:3:16: warning: expression using sizeof bool * check-error-end */