Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 22:30:43 +0100
From:      Ulrich =?utf-8?B?U3DDtnJsZWlu?= <uqs@spoerlein.net>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        freebsd-current@freebsd.org, Erik Cederstrand <erik@cederstrand.dk>
Subject:   Re: FYI: clang static analyzer page has moved to http://scan.freebsd.your.org/freebsd-head/
Message-ID:  <20110105213043.GT23329@acme.spoerlein.net>
In-Reply-To: <20110105193653.GA49285@stack.nl>
References:  <20110105131439.GN23329@acme.spoerlein.net> <4184C8F2-3C6D-46FB-8F10-DDEBA6DB1C35@cederstrand.dk> <AD2AEFFB-37A4-4DAB-9094-7289C1C8B0DD@cederstrand.dk> <201101050934.49845.jhb@freebsd.org> <20110105165545.GP23329@acme.spoerlein.net> <20110105193653.GA49285@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 05.01.2011 at 20:36:53 +0100, Jilles Tjoelker wrote:
> On Wed, Jan 05, 2011 at 05:55:45PM +0100, Ulrich Spörlein wrote:
> > On Wed, 05.01.2011 at 09:34:49 -0500, John Baldwin wrote:
> > > These are all marked as __dead2, so the compiler should "know" that these do
> > > not return.
> 
> > And clang did the right thing here in the past. Beware that it does no
> > inter-procedural analysis yet, so it will usually miss that usage()
> > calls exit unconditionally.
> 
> > *But*, it should grok that for err(3) and exit(3). Now there are some
> > possible remedies:
> 
> > - get IPA to work with clang, or at least file a bug
> 
> > - mark functions as __dead2 (please don't do that)
> 
> Why not?

Cause IMHO it adds clutter, is noisy and needs to be maintained
manually, when we have these "computer" things that should deduct this
by themselves.

> I have done this in some cases because it leads to better code with gcc
> (the system version in 9-current). See SVN commit r212508 to
> bin/sh/parser.c. Although synexpect() and synerror() are static, adding
> __dead2 to both makes the executable 576 bytes smaller on i386 (these
> functions are called many times).  Adding __dead2 to synexpect() only
> causes a warning "noreturn function does return" (it calls synerror()).
> Adding __dead2 to synerror() only also makes the executable smaller but
> not as much as adding it to both.
> 
> Reordering the functions in the file does not help to make gcc see that
> the functions do not return.

This is too bad and really makes me sad. It shouldn't be necessary to
hand-hold the compilers like that. Could you try some tests with gcc 4.5
to confirm this is still required?

Uli



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110105213043.GT23329>