linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Josh Triplett <josh@freedesktop.org>
Cc: Pavel Roskin <proski@gnu.org>, linux-sparse@vger.kernel.org
Subject: Re: [PATCH 2/6] Hardcode actual type sizes, add -m32 support
Date: Thu, 28 Jun 2007 07:23:56 +0100	[thread overview]
Message-ID: <20070628062355.GF21478@ftp.linux.org.uk> (raw)
In-Reply-To: <46834FA0.8010201@freedesktop.org>

On Wed, Jun 27, 2007 at 11:05:20PM -0700, Josh Triplett wrote:
> Al Viro wrote:
> > On Thu, Jun 28, 2007 at 01:39:59AM -0400, Pavel Roskin wrote:
> >> Use the actual sizeof values at the compile time to describe the default
> >> target.  If sparse is compiled on a 64-bit system, it will default to a
> >> 64-bit system now.
> >>
> >> To force 32-bit operation on 64-bit systems, recognize -m32.  Reject
> >> machine options other than -m32 and -m64.
> > 
> > NAK.  That makes life very painful for cross-builds.
> 
> And the current approach of hard-coding all the sizes doesn't?
> 
> While I agree that I'd like a better approach (specifically, I want any Sparse
> build to support any target arch), I don't yet have a solution for that, and
> this patch does at least seem like an improvement over the current hardcoded
> values.

At least it guarantees behaviour that depends only on the arguments you
pass to sparse and is consistent between the boxen you run sparse _on_.

FWIW, one of the pending patches in my tree makes default size_t unsigned
int, switches it upon -m64 and adds explicit -msize-long for forcing the
same in absense of -m64 (i.e. for 32bit target that has size_t declared
as unsigned long).

The reason why it becomes needed is that with proper typechecking on
comparisons we get every bloody target with size_t declared as unsigned
int (i.e. practically all 32bit ones; the only exception I've seen
is s390 31bit which uses unsigned long) complaining about every
min((size_t)n, sizeof(v)) in the kernel - the second argument becomes
sparse idea of size_t, the first one - kernel idea of size_t and
safety check in min() consist of comparing pointers to types of arguments.

That rule (no m64 => size_t is unsigned int, m64 => unsigned long) gives
a very good approximation and all deviations from it are for 32bit
targets with unsigned long instead of unsigned int.

Having types based on the host sparse is built on is utter insanity -
if anything, we need to be very careful about leaking them into
sparse operations.  Just take a look at what portability nightmare
binutils had become due to that approach...

  reply	other threads:[~2007-06-28  6:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-28  5:39 [PATCH 1/6] Bitfield without explicit sign should be a warning, not an error Pavel Roskin
2007-06-28  5:39 ` [PATCH 2/6] Hardcode actual type sizes, add -m32 support Pavel Roskin
2007-06-28  5:58   ` Al Viro
2007-06-28  6:05     ` Josh Triplett
2007-06-28  6:23       ` Al Viro [this message]
2007-06-28  6:27         ` Jeff Garzik
2007-06-28  6:46         ` Josh Triplett
2007-06-28  6:25       ` Jeff Garzik
2007-06-28  6:44         ` Pavel Roskin
2007-06-28  6:47           ` Jeff Garzik
2007-06-28  6:55             ` Josh Triplett
2007-06-28  6:54         ` Josh Triplett
2007-06-28  7:01           ` Jeff Garzik
2007-06-28  7:38             ` Josh Triplett
2007-06-28  6:27       ` Pavel Roskin
2007-06-28  5:40 ` [PATCH 3/6] cgcc: preserve sparse exit code if -no-compile is used Pavel Roskin
2007-06-28  6:12   ` Josh Triplett
2007-06-28  5:40 ` [PATCH 4/6] Avoid use of libc headers in the validation suite Pavel Roskin
2007-06-28  6:14   ` Josh Triplett
2007-06-28  5:40 ` [PATCH 5/6] Fix warnings about undeclared globals, they are irrelevant to the test Pavel Roskin
2007-06-28  6:18   ` Josh Triplett
2007-06-28  5:40 ` [PATCH 6/6] Add a simple test script, embed expected results into test files Pavel Roskin
2007-06-28  7:20   ` Josh Triplett
2007-06-28 18:59     ` Damien Lespiau
2007-06-28 21:21       ` Pavel Roskin
2007-06-28 21:38       ` Josh Triplett
2007-06-29  0:13         ` Damien Lespiau
2007-06-29  0:29           ` Josh Triplett
2007-07-02  4:59             ` Damien Lespiau
2007-07-02  5:19               ` Josh Triplett
2007-07-08 21:52               ` Josh Triplett
2007-07-09  2:15                 ` Josh Triplett
2007-07-09 21:27                   ` Damien Lespiau
2007-07-11  0:48                     ` Anderson Lizardo
2007-06-28  6:09 ` [PATCH 1/6] Bitfield without explicit sign should be a warning, not an error Josh Triplett

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=20070628062355.GF21478@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=proski@gnu.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).