linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: [RFC PATCH] bits_in_bool should be 8
Date: Mon, 14 Nov 2016 21:27:41 -0500	[thread overview]
Message-ID: <1479176861.7928.3.camel@redhat.com> (raw)
In-Reply-To: <CANeU7QkTp9O3d4NP+9oW3CUdBvS6-65kByroYj-HhnPv5aUhBA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]

On Tue, 2016-11-15 at 08:23 +0800, Christopher Li wrote:
> On Tue, Nov 15, 2016 at 4:50 AM, Jeff Layton <jlayton@redhat.com> wrote:
> > Given that we're working with byte-addressable machines, each type must
> > be at least one byte in size or you'd not be able to take a pointer to
> > it.
> > 
> > Noticed at random when I ran the sample "compile" program in the
> > sparse source tree vs. a test C program that uses bools. It crashes
> > without this patch.
> 
> Do you have the test program to crash sparse?
> 
> Sparse should handle bool size correctly. The bits_in_bool is
> a internal thing for sparse. From sizeof(bool) point of view,
> sparse should treat sizeof(bool) as 8 bits. But bool has only
> one bit usable value.
> 
> Chris

Attached. This is also the program I was using to track down the
storage_modifiers problem.

To be clear though, sparse doesn't crash here. I happened to run the
"compile" example program that's in the sources against it while poking
at the other problem and noticed that it crashed.

I don't think we really care much about "compile", but it looked like
it might be indicative of a problem in sparse itself.

-- 
Jeff Layton <jlayton@redhat.com>

[-- Attachment #2: errtest.c --]
[-- Type: text/x-csrc, Size: 333 bytes --]

#include <stdio.h>
#include <stdbool.h>

#define MAX_ERRNO       4095
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
#define __force __attribute__((force))

static inline bool IS_ERR(__force const void *ptr)
{
        return IS_ERR_VALUE((unsigned long)ptr);
}

int
main(int argc, char **argv)
{
	return IS_ERR(NULL);
}


      reply	other threads:[~2016-11-15  2:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 20:50 [RFC PATCH] bits_in_bool should be 8 Jeff Layton
2016-11-15  0:23 ` Christopher Li
2016-11-15  2:27   ` Jeff Layton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479176861.7928.3.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).