<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.parsers.sparse">
    <title>gmane.comp.parsers.sparse</title>
    <link>http://blog.gmane.org/gmane.comp.parsers.sparse</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2835"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2828"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2802"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2795"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2794"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2789"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2786"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2772"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2770"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2769"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2768"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2766"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2748"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2742"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2741"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2737"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2730"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2726"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2718"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.parsers.sparse/2717"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2835">
    <title>[PATCH] Updated __nocast vs __bitwise documentation</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2835</link>
    <description>&lt;pre&gt;I have updated the sparse.1 man page including the __bitwise
relevant content, and created Documentation/sparse.txt with the
complete comparison between __nocast vs __bitwise.

Signed-off-by: Shakthi Kannan &amp;lt;shakthimaan&amp;lt; at &amp;gt;gmail.com&amp;gt;
---
 Documentation/sparse.txt |   39 +++++++++++++++++++++++++++++++++++++++
 sparse.1                 |   14 +++++++++++++-
 2 files changed, 52 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/sparse.txt

diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
new file mode 100644
index 0000000..37e8916
--- /dev/null
+++ b/Documentation/sparse.txt
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -0,0 +1,39 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
+Sparse
+~~~~~~
+
+__nocast vs __bitwise:
+
+__nocast warns about explicit or implicit casting to different types.
+
+HOWEVER, it doesn't consider two 32-bit integers to be different
+types, so a __nocast 'int' type may be returned as a regular 'int'
+type and then the __nocast is lost.
+
+So "__nocast" on integer types is usually not that powerful. It just
+gets lost too easily. It's more useful for things like pointers. It
+also doesn't warn about the mixing: you can add integers to __nocast
+integer types, and it's not really considered anything wrong.
+
+__bitwise ends up being a "stronger integer separation". That one
+doesn't allow you to mix with non-bitwise integers, so now it's much
+harder to lose the type by mistake.
+
+So the basic rule is:
+
+ - "__nocast" on its own tends to be more useful for *big* integers
+that still need to act like integers, but you want to make it much
+less likely that they get truncated by mistake. So a 64-bit integer
+that you don't want to mistakenly/silently be returned as "int", for
+example. But they mix well with random integer types, so you can add
+to them etc without using anything special. However, that mixing also
+means that the __nocast really gets lost fairly easily.
+
+ - "__bitwise" is for *unique types* that cannot be mixed with other
+types, and that you'd never want to just use as a random integer (the
+integer 0 is special, though, and gets silently accepted iirc - it's
+kind of like "NULL" for pointers). So "gfp_t" or the "safe endianness"
+types would be __bitwise: you can only operate on them by doing
+specific operations that know about *that* particular type.
+
+Generally, you want __bitwise if you are looking for type safety.
+"__nocast" really is pretty weak.
diff --git a/sparse.1 b/sparse.1
index bde6b6d..ae85b54 100644
--- a/sparse.1
+++ b/sparse.1
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -53,7 +53,19 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; arithmetic operations other than bitwise
operations, and on any conversion of
 one restricted type into another, except via a cast that includes
 \fB__attribute__((force))\fR.

-Sparse does not issue these warnings by default.
+__bitwise ends up being a "stronger integer separation". That one
+doesn't allow you to mix with non-bitwise integers, so now it's much
+harder to lose the type by mistake.
+
+__bitwise is for *unique types* that cannot be mixed with other
+types, and that you'd never want to just use as a random integer (the
+integer 0 is special, though, and gets silently accepted iirc - it's
+kind of like "NULL" for pointers). So "gfp_t" or the "safe endianness"
+types would be __bitwise: you can only operate on them by doing
+specific operations that know about *that* particular type.
+
+Generally, you want bitwise if you are looking for type safety. Sparse
+does not issue these warnings by default.
 .
 .TP
 .B \-Wcast\-to\-as
&lt;/pre&gt;</description>
    <dc:creator>Shakthi Kannan</dc:creator>
    <dc:date>2012-05-10T06:54:28</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2828">
    <title>simplify: conservative handling of casts with pointers</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2828</link>
    <description>&lt;pre&gt;When the cast is optimized out/target pointer type information lost,
it may be impossible to for backend to recover it (think of
"struct foo *my_new_foo = malloc(sizeof(*my_new_foo))").

Losing such pointer type information can be wider issue (structs and
unions maybe), but this is the most exposed one and the patch tries
to be minimal in this regard and the impact seems to be minimal
too as usually type-correctness is followed.

Annotated demonstration of the change (part of "test-linearize allocate.c",
function allocate):

before:

.L0x7fd091ecb510:
        load.32     %r76 &amp;lt;- 20[%arg1]
        cast.64     %r78 &amp;lt;- (32) %r76
        call.64     %r79 &amp;lt;- blob_alloc, %r78
        br          %r79, .L0x7fd091ecb650, .L0x7fd091ecb600

.L0x7fd091ecb600:
        call        die, "out of memory"
        br          .L0x7fd091ecb650

.L0x7fd091ecb650:
        load.32     %r85 &amp;lt;- 36[%arg1]
        add.32      %r87 &amp;lt;- %r85, %r76
        store.32    %r87 -&amp;gt; 36[%arg1]
        store.64    %r30(blob) -&amp;gt; 0[%r79]
        store.64    %r79 -&amp;gt; 8[%arg1]
        add.64      %r98 &amp;lt;- %r28, $15
        [...]

after:

.L0x7fab5bc11510:
        load.32     %r76 &amp;lt;- 20[%arg1]
        cast.64     %r78 &amp;lt;- (32) %r76
        call.64     %r79 &amp;lt;- blob_alloc, %r78
        cast.64     %r80 &amp;lt;- (64) %r79
        br          %r80, .L0x7fab5bc11650, .L0x7fab5bc11600

.L0x7fab5bc11600:
        call        die, "out of memory"
        br          .L0x7fab5bc11650

.L0x7fab5bc11650:
        load.32     %r85 &amp;lt;- 36[%arg1]
        add.32      %r87 &amp;lt;- %r85, %r76
        store.32    %r87 -&amp;gt; 36[%arg1]
        store.64    %r30(blob) -&amp;gt; 0[%r80]
        store.64    %r80 -&amp;gt; 8[%arg1]
        add.64      %r98 &amp;lt;- %r28, $15
        [...]

Signed-off-by: Jan Pokorný &amp;lt;pokorny_jan&amp;lt; at &amp;gt;seznam.cz&amp;gt;
---
 simplify.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/simplify.c b/simplify.c
index 8200584..3b2b03c 100644
--- a/simplify.c
+++ b/simplify.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -10,6 +10,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt;
 #include "expression.h"
 #include "linearize.h"
 #include "flow.h"
+#include "symbol.h"
 
 /* Find the trivial parent for a phi-source */
 static struct basic_block *phi_parent(struct basic_block *source, pseudo_t pseudo)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -667,6 +668,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int simplify_cast(struct instruction *insn)
 orig_type = insn-&amp;gt;orig_type;
 if (!orig_type)
 return 0;
+
+/* Avoid possible loss of pointer type info (OP_PTRCAST skipped below) */
+if (is_ptr_type(orig_type) != is_ptr_type(insn-&amp;gt;type))
+return 0;  /* non-pointer vs. pointer or viceversa */
+else if (orig_type-&amp;gt;type == SYM_PTR &amp;amp;&amp;amp; insn-&amp;gt;opcode != OP_PTRCAST)
+return 0;  /* any type from "void *" (see alloc_cast_instruction) */
+
 orig_size = orig_type-&amp;gt;bit_size;
 size = insn-&amp;gt;size;
 src = insn-&amp;gt;src;
&lt;/pre&gt;</description>
    <dc:creator>Jan Pokorný</dc:creator>
    <dc:date>2012-05-08T14:13:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2802">
    <title>[PATCH] unssa: track use of newly added pseudo</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2802</link>
    <description>&lt;pre&gt;Currently, it is a completely "isolated island" from backend
point of view as it also lacks pseudo-&amp;gt;def information.

Signed-off-by: Jan Pokorný &amp;lt;pokorny_jan&amp;lt; at &amp;gt;seznam.cz&amp;gt;
---
 unssa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/unssa.c b/unssa.c
index 3eea9b2..382095d 100644
--- a/unssa.c
+++ b/unssa.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -55,7 +55,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void replace_phi_node(struct instruction *phi)
 track_phi_uses(phi);
 
 phi-&amp;gt;opcode = OP_COPY;
-phi-&amp;gt;src = tmp;
+use_pseudo(phi, tmp, &amp;amp;phi-&amp;gt;src);
 
 // FIXME: free phi-&amp;gt;phi_list;
 }
&lt;/pre&gt;</description>
    <dc:creator>Jan Pokorný</dc:creator>
    <dc:date>2012-05-03T14:59:11</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2795">
    <title>dependency tee from c parser entities downto token</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2795</link>
    <description>&lt;pre&gt;Hi, I'd like to extend sparse so that I can preserve a
dependency tree that goes from c parse entities all
the way down to single tokens. There are several places
this can be useful:
  1. If you have :
    "#include &amp;lt;stdio.h&amp;gt; int main() {}"
    and add for instance
    "#include &amp;lt;stdio.h&amp;gt; int main() {FILE *f;}"
    what are the macros and structs that are used for this single "FILE *f;"?
    (With macros and all #ifdef nesting macros dependencies and their dependendies
     and macros in macro arg/body substitutions and also macros in c parse entities
     that FILE (struct _IO_FILE) c-depends on)
  2. If you have a compilation with a fixed options-line, calculate
    a minimal c sourcefile that is "pre pre-processor" that compiles correctly.
    This would save time in compilation, stripping away all unneeded
    macros defines and declarations.
  3. You could also use it to write tools to show the
    dependency tree of macros at a particular location of the source...
    something all c-coders long for (at least me :-).

For case (1.) I have created a dirty prototype that on sourceforge
does this

$git clone git://git.code.sf.net/p/decpp/code decpp
$cd decpp
$make
$./shrinkc t1.c

The output is below ("output of "shrinkc"").

Before I start to submit patches I'd like to as weather
there is there is interest for such a development, or better
weather there is interest of such a development if I do
the work, as maybe you rather want to do it yourself, I
also first ask because otherwise I'll put time in it
and none will apply the patches in the end anyway.

Here is how i'd do it:

- Try to not mess with basic structs like "struct token" etc.
   by adding a little hash based attibute tagging to void * pointers
   so that additional information can be stored for each sparse
   entity in seperate stuctures.
- modify pre-processor.c to not overwrite already created  tokens
   but instead duplicate them. Of course also avoid freeing tokens.
   Also preserve the undef/define history of macros (by not reusing
   the macro symbols)
- Buildup the macro dependency tree created from macros expansion
   and #if statements
- Tag all tokens with extra informations: macro dependency as well
   as source-stream end location (to be able to reconstruct).
- write a traversal that descends from translation-units through the
   dependency tree down to the tokens and marks them as used. Or maybe
   downto a "used-char" bitfield in streams.

Opon that, useful tools (as I think) could be built up.

&lt;/pre&gt;</description>
    <dc:creator>Konrad Eisele</dc:creator>
    <dc:date>2012-04-24T09:54:45</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2794">
    <title>Please be informed!</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2794</link>
    <description>&lt;pre&gt;Please be informed that you have $250,000.00 to transfer to you as
Compensation.


-----------------------------------------
   "Universidad Autónoma de Yucatán"
http://www.uady.mx/

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Western Union®</dc:creator>
    <dc:date>2012-04-05T06:14:16</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2789">
    <title>Killing off __cond_lock()</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2789</link>
    <description>&lt;pre&gt;Hi all,

So the kernel has this __cond_lock() crap pile, which is implemented
like:

#define __acquire(x)       __context__(x,1)
#define __cond_lock(x,c)   ((c) ? ({ __acquire(x); 1; }) : 0)

Now the problem with this is that people send ugly patches like:

https://lkml.org/lkml/2012/3/24/57
http://www.spinics.net/lists/mm-commits/msg80386.html

That basically wrap an existing function in an inline function just to
use __cond_lock() on the return value.

It would be ever so much nicer if we could declare such functions like:

struct anon_vma *page_lock_anon_vma(struct page *page)
__cond_acquires(RCU) 
__cond_acquires(page_lock_anon_vma(page)-&amp;gt;root-&amp;gt;lock);

Meaning that if the return value is true (non-zero), it would acquire
that lock/context. One could of course add some shorter means of
referring to the return value, but simply using the function in the
expression should be simple enough.

In order to implement this I guess we need to extend the
__attribute__((context(expr,in,out))) thing. 

Currently in,out are explicit value constants, but I guess if we make
them expressions we could evaluate them and get dynamic behaviour.

Thus allowing something like:

int spin_trylock(spinlock_t *lock)
__attribute__((context(lock, 0, !!spin_trylock(lock));

meaning that the context would be incremented by 1 if the return value
were true.

Having only briefly looked at the sparse source, is this feasible to
implement or do we get chicken/egg problems wrt using a function before
its declaration is complete, and referring a return value before the
function is part of an expression?

If this yields problems, are there better ways of solving this issue?
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Peter Zijlstra</dc:creator>
    <dc:date>2012-03-24T16:23:36</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2786">
    <title>help needed: document __nocast vs __bitwise (Was: [PATCH 00/16] mm: prepare for converting vm-&gt;vm_flags to 64-bit)</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2786</link>
    <description>&lt;pre&gt;Linus has a very nice write up about __nocast vs __bitwise.

Can any one help to integrate the write up to a patch
against man page sparse.1?

I would much rather hitting the apply button than hacking
documents. But if nobody wants to do it, it would have to
be me then.

Yes, I am a lazy baster :-)

Thanks

Chris

---------- Forwarded message ----------
From: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
Date: Thu, Mar 22, 2012 at 3:08 PM
Subject: Re: [PATCH 00/16] mm: prepare for converting vm-&amp;gt;vm_flags to 64-bit
To: Andrew Morton &amp;lt;akpm&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
Cc: Al Viro &amp;lt;viro&amp;lt; at &amp;gt;zeniv.linux.org.uk&amp;gt;, Konstantin Khlebnikov
&amp;lt;khlebnikov&amp;lt; at &amp;gt;openvz.org&amp;gt;, Minchan Kim &amp;lt;minchan&amp;lt; at &amp;gt;kernel.org&amp;gt;,
"linux-mm&amp;lt; at &amp;gt;kvack.org" &amp;lt;linux-mm&amp;lt; at &amp;gt;kvack.org&amp;gt;,
"linux-kernel&amp;lt; at &amp;gt;vger.kernel.org" &amp;lt;linux-kernel&amp;lt; at &amp;gt;vger.kernel.org&amp;gt;, Hugh
Dickins &amp;lt;hughd&amp;lt; at &amp;gt;google.com&amp;gt;, KOSAKI Motohiro
&amp;lt;kosaki.motohiro&amp;lt; at &amp;gt;jp.fujitsu.com&amp;gt;, Ben Herrenschmidt
&amp;lt;benh&amp;lt; at &amp;gt;kernel.crashing.org&amp;gt;, "linux&amp;lt; at &amp;gt;arm.linux.org.uk"
&amp;lt;linux&amp;lt; at &amp;gt;arm.linux.org.uk&amp;gt;


On Thu, Mar 22, 2012 at 2:41 PM, Andrew Morton
&amp;lt;akpm&amp;lt; at &amp;gt;linux-foundation.org&amp;gt; wrote:

__nocast warns about explicit or implicit casting to different types.

HOWEVER, it doesn't consider two 32-bit integers to be different
types, so a __nocast 'int' type may be returned as a regular 'int'
type and then the __nocast is lost.

So "__nocast" on integer types is usually not that powerful. It just
gets lost too easily. It's more useful for things like pointers. It
also doesn't warn about the mixing: you can add integers to __nocast
integer types, and it's not really considered anything wrong.

__bitwise ends up being a "stronger integer separation". That one
doesn't allow you to mix with non-bitwise integers, so now it's much
harder to lose the type by mistake.

So basic rules is:

 - "__nocast" on its own tends to be more useful for *big* integers
that still need to act like integers, but you want to make it much
less likely that they get truncated by mistake. So a 64-bit integer
that you don't want to mistakenly/silently be returned as "int", for
example. But they mix well with random integer types, so you can add
to them etc without using anything special. However, that mixing also
means that the __nocast really gets lost fairly easily.

 - "__bitwise" is for *unique types* that cannot be mixed with other
types, and that you'd never want to just use as a random integer (the
integer 0 is special, though, and gets silently accepted iirc - it's
kind of like "NULL" for pointers). So "gfp_t" or the "safe endianness"
types would be __bitwise: you can only operate on them by doing
specific operations that know about *that* particular type.

Generally, you want __bitwise if you are looking for type safety.
"__nocast" really is pretty weak.

                 Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Christopher Li</dc:creator>
    <dc:date>2012-03-23T18:17:10</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2772">
    <title>Using c2xml on kernel sources</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2772</link>
    <description>&lt;pre&gt;Hi,

I would like to run c2xml on the Linux kernel sources. Is there a
recommended way of using the tool on kernel code?

I tried running it directly on a source file, but, get the
'header-file "unable to open" error.

  $ c2xml linux-3.0.4/net/ethernet/eth.c

  ../linux-3.0.4/net/ethernet/eth.c:40:11: error: unable to open
'linux/module.h'

I have built sparse from git sources (v0.4.4) on Fedora 15 x86_64.

Appreciate any inputs in this regard.

Thanks!

SK

&lt;/pre&gt;</description>
    <dc:creator>Shakthi Kannan</dc:creator>
    <dc:date>2012-03-20T09:00:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2770">
    <title>Patch: add __builtin_stpcpy and __sync_synchronize to builtin functions</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2770</link>
    <description>&lt;pre&gt;Hi,

while working on integrating sparse checks in systemd, I noticed some
builtin functions need to be added to sparse list. See attached patch
for the fix.

I've also noted patch from Pekka Enberg
(http://www.spinics.net/lists/linux-sparse/msg02520.html ) is still
needed when running sparse on x86-64. It would be nice to merge it in
git.

&lt;/pre&gt;</description>
    <dc:creator>Frederic Crozat</dc:creator>
    <dc:date>2012-03-15T14:15:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2769">
    <title>MAIL 10.03.2012</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2769</link>
    <description>&lt;pre&gt;Mail From Tang.

I work with the hang seng Bank Hong Kong.I have a business proposition for you involving a trade in my bank which I know we will be of mutual benefit to both of us, If interested mail me at:tangricad&amp;lt; at &amp;gt;yahoo.co.jp

Regards,
Richard Tang.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Mr. Richard Tang</dc:creator>
    <dc:date>2012-03-11T10:05:28</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2768">
    <title>strings</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2768</link>
    <description>&lt;pre&gt;Hi folks !

I just noticed, as I was digging into (yet another) unrelated llvm
problem with my code, that sparse-llvm fails to compile something that
has a statement such as:

static char *foo = "Foo !\n";

It pukes in output_data(), where we have initializer non-NULL and
initializer-&amp;gt;type is EXPR_STRING. So we hit the default: case which is
an assert(0);

Now a trivial "fix" below doesn't quite work:

diff --git a/sparse-llvm.c b/sparse-llvm.c
index 9226a21..f151939 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1181,6 +1181,12 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
 initial_value = output_data(module, sym);
 break;
 }
+case EXPR_STRING: {
+const char *s = initializer-&amp;gt;string-&amp;gt;data;
+
+initial_value = LLVMConstString(strdup(s), strlen(s) + 1, true);
+break;
+}
 default:
 assert(0);
 }

That has two interesting effects. First, if llvm is compiled with asserts,
it pukes claiming that the initializer is of the wrong type. Now that's
odd because as far as I can tell, the type is an array of i8 ... and it
works if you don't build the asserts in llvm.

Mind you, I had that problem with a different program, which was using
the various "InContext" variants of the various functions rather than
the global context ones... because at one point I was using the global
context for one of the LLVMInt8Type and that made it fail (again worked
fine without asserts).

Looks like the assert internally to LLVM is a pointer comparison of
Type * so it has to resolve to -exactly- the same type object internally,
pretty touchy. Maybe throwing a cast might help.

The second effect however is that the result is not nice:

  .../...

&amp;lt; at &amp;gt;"&amp;lt;noident&amp;gt;" = private global [7 x i8] c"Foo !\0A\00"
&amp;lt; at &amp;gt;foo = private global i8* &amp;lt; at &amp;gt;"&amp;lt;noident&amp;gt;"

  .../...

I haven't quite manage to coerce it to just have a single &amp;lt; at &amp;gt;foo = &amp;lt;something&amp;gt;
so it looks like we need to separately define the storage (the string)
and foo as a pointer to it, unless I missed something.

I tried to use the same construct we use in pseudo_to_value() (I factored
it out) but that results in worse output, where it now names the string
(.str&amp;lt;N&amp;gt;) but then creates a &amp;lt;noident&amp;gt; ptr and then assigns that to foo...

LLVM is harder than it seems :-)

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Benjamin Herrenschmidt</dc:creator>
    <dc:date>2012-03-03T10:46:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2766">
    <title>sparse-llvm: pseudo_to_value: Assertion `sym-&gt;ident == ((void *)0)' failed</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2766</link>
    <description>&lt;pre&gt;Hi folks !

Haven't had a chance to investigate further today (and probably won't)
so I'm shooting this here just in case ;-)

I was tracking down what looks like an LLVM bug with sign extension from
1-bit integers while playing with llvmpipe (gallium llvm backend) and
out of curiosity decided to look at what sparse generated when
sign-extending a bool :-)

So I added to my earlier hello.c some statements to that effect, and
trying to compile it results in:

sparse-llvm.c:311: pseudo_to_value: Assertion `sym-&amp;gt;ident == ((void *)0)' failed.

The new hello.c is:

#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;

int main(void)
{
        int i;
        double f1,f2;
        bool eq;

        printf("Hello World !\n");

        for (i = 0; i &amp;lt; 10; i ++)
                printf("I can count to %d\n", i);

        printf("f1=");
        scanf("%f",&amp;amp;f1);
        printf("f2=");
        scanf("%f",&amp;amp;f2);

        eq = f1 == f2;

        printf("f1==f2: %d\n", (int)eq);
        return 0;
}

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Benjamin Herrenschmidt</dc:creator>
    <dc:date>2012-02-13T07:17:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2748">
    <title>[RFC/PATCH 1/2] sparse, llvm: Make function declaration accessible to backend</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2748</link>
    <description>&lt;pre&gt;From: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;

On Tue, Aug 30, 2011 at 10:43 AM, Jeff Garzik &amp;lt;jeff&amp;lt; at &amp;gt;garzik.org&amp;gt; wrote:

Hmm. Right now we do not have access to the function declaration at
linearize time. We've checked that the arguments match, and we've cast
the arguments to the right types (evaluate.c), so the thinking was
that you just use the arguments as-is.

But if llvm needs the declaration of a function, we'd need to squirrel it away.

Cc: Benjamin Herrenschmidt &amp;lt;benh&amp;lt; at &amp;gt;kernel.crashing.org&amp;gt;
Cc: Christopher Li &amp;lt;sparse&amp;lt; at &amp;gt;chrisli.org&amp;gt;
Cc: Jeff Garzik &amp;lt;jgarzik&amp;lt; at &amp;gt;redhat.com&amp;gt;
Cc: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
[ penberg&amp;lt; at &amp;gt;kernel.org: Fix validation/context.c breakage. ]
Signed-off-by: Pekka Enberg &amp;lt;penberg&amp;lt; at &amp;gt;kernel.org&amp;gt;
---
 linearize.c |    8 ++++++++
 linearize.h |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/linearize.c b/linearize.c
index 1899978..7d57474 100644
--- a/linearize.c
+++ b/linearize.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1195,6 +1195,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static pseudo_t linearize_call_expression(struct entrypoint *ep, struct expressi
 struct instruction *insn = alloc_typed_instruction(OP_CALL, expr-&amp;gt;ctype);
 pseudo_t retval, call;
 struct ctype *ctype = NULL;
+struct symbol *fntype;
 struct context *context;
 
 if (!expr-&amp;gt;ctype) {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1212,6 +1213,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static pseudo_t linearize_call_expression(struct entrypoint *ep, struct expressi
 if (fn-&amp;gt;ctype)
 ctype = &amp;amp;fn-&amp;gt;ctype-&amp;gt;ctype;
 
+fntype = fn-&amp;gt;ctype;
+if (fntype) {
+if (fntype-&amp;gt;type == SYM_NODE)
+fntype = fntype-&amp;gt;ctype.base_type;
+}
+insn-&amp;gt;fntype = fntype;
+
 if (fn-&amp;gt;type == EXPR_PREOP) {
 if (fn-&amp;gt;unop-&amp;gt;type == EXPR_SYMBOL) {
 struct symbol *sym = fn-&amp;gt;unop-&amp;gt;symbol;
diff --git a/linearize.h b/linearize.h
index 424ba97..61fbd83 100644
--- a/linearize.h
+++ b/linearize.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -116,6 +116,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; struct instruction {
 struct /* call */ {
 pseudo_t func;
 struct pseudo_list *arguments;
+struct symbol *fntype;
 };
 struct /* context */ {
 int increment;
&lt;/pre&gt;</description>
    <dc:creator>Pekka Enberg</dc:creator>
    <dc:date>2012-02-01T09:55:51</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2742">
    <title>[PATCH] evaluate: reject post-ops on void*</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2742</link>
    <description>&lt;pre&gt;Following example haven't been linearized correctly:

static void *inc_ptr(void *a) {
return ++a;
}

test-linearize:

&amp;lt;entry-point&amp;gt;
add.32      %r2 &amp;lt;- %arg1, $-1
ret.32      %r2

Apparently, something went wrong with -1 value to be added to the original
pointer.  When void* substituted for int*, the result is as expected
(considering 32b int):

&amp;lt;entry-point&amp;gt;
add.32      %r2 &amp;lt;- %arg1, $4
ret.32      %r2

The proposed patch turns post-ops on void* operand into an error
(taking the same route as with function operand).

When running check with C=2 on my old linux-3.0.6 configuration,
this detected a few occurencies:

drivers/scsi/scsi_proc.c:405:31: error: bad argument type for ++/--
drivers/scsi/scsi_proc.c:413:23: error: bad argument type for ++/--
net/bluetooth/hci_core.c:1545:29: error: bad argument type for ++/--
net/bluetooth/l2cap_core.c:1825:37: error: bad argument type for ++/--
net/bluetooth/bnep/core.c:239:13: error: bad argument type for ++/--
lib/sort.c:25:27: error: bad argument type for ++/--
lib/sort.c:26:27: error: bad argument type for ++/--
lib/check_signature.c:21:24: error: bad argument type for ++/--

All of them seems trivially fixable.

Alternatively, I can turn it to emit an warning only (should be
configurable/default?).  To be noted that GCC will only emit an warning,
and only if -pedantic or -Wpointer-arith specified, but I consider
it rather a convenient exception.

When this gets clear, I'll add also the respective test-case.

Signed-off-by: Jan Pokorny &amp;lt;pokorny_jan&amp;lt; at &amp;gt;seznam.cz&amp;gt;
---
 evaluate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/evaluate.c b/evaluate.c
index bebe968..b6d706b 100644
--- a/evaluate.c
+++ b/evaluate.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -1711,7 +1711,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static struct symbol *evaluate_postop(struct expression *expr)
 multiply = 1;
 } else if (class == TYPE_PTR) {
 struct symbol *target = examine_pointer_target(ctype);
-if (!is_function(target))
+/* beside function, reject also void* (due to sizeof(void)) */
+if (target != &amp;amp;void_ctype &amp;amp;&amp;amp; !is_function(target))
 multiply = bits_to_bytes(target-&amp;gt;bit_size);
 }
 
&lt;/pre&gt;</description>
    <dc:creator>Jan Pokorný</dc:creator>
    <dc:date>2012-01-22T23:31:21</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2741">
    <title>sparse-llvm has been merged</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2741</link>
    <description>&lt;pre&gt; Pekka's sparse-llvm has been merged at sparse chrisl branch.

http://git.kernel.org/?p=devel/sparse/chrisl/sparse.git;a=summary

The new llvm back end require llvm 3.0.

Chris

Merge branch 'sparse-llvm' of git://github.com/penberg/sparse-llvm.git

    'master' branch of git://github.com/penberg/sparse-llvm.git

        Revert "sparse: Bump up sizeof(_Bool) to 8 bits"
        sparse, llvm: Add test case for &amp;lt;stdbool.h&amp;gt; type
        sparse, llvm: Use LLVMInt1Type() in sym_basetype_type()
        sparse, llvm: Don't fail the build if LLVM is too old
        Merge pull request #6 from jgarzik/hacks
        sparse, llvm: add loop testcase
        sparse, llvm: Fix loops, by properly handling OP_PHI forward references
        sparse, llvm: FP comparison op code generation
        sparse, llvm: Simplify comparison op code generation
        sparse, llvm: More comparison ops code generation
        sparse, llvm: OP_SET_B and OP_SET_A code generation
        sparse, llvm: Pointer cast code generation
        sparse, llvm: Make llc output to stdout in sparsec
        sparse, llvm: Fix 'extern' symbol code generation
        sparse, llvm: Fix symbol initializer code generation
        sparse, llvm: Function pointer code generation
        sparse, llvm: Make 'sparsec' error handling more robust
        sparse, llvm: Add support for union types
        sparse, llvm: Add support for array types
        sparse, llvm: Fix symbol_type() for bitfields and enums
        sparse, llvm: Fix struct code generation
        sparse, llvm: Use new LLVM type system API for structs
        sparse, llvm: Fix 'void *' pointer code generation
        sparse, llvm: Add support for logical ops
        sparse: Bump up sizeof(_Bool) to 8 bits
        sparse, llvm: Add support for symbol initializers
        sparse, llvm: Add support for struct types
        sparse, llvm: Fix code generation for 'long double' data type
        Merge pull request #4 from jgarzik/hacks
        sparse, llvm: support OP_STORE
        sparse, llvm: move OP_COPY support to separate function.  Add
FP support.
        sparse, llvm: store module-local functions on function reference list
        llvm, sparse: Fix symbol_is_fp_type() goof
        Merge branch 'master' of github.com:penberg/sparse-llvm
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Christopher Li</dc:creator>
    <dc:date>2012-01-19T02:00:22</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2737">
    <title>[PATCH] sparse: Add 'leaf' to ignored attributes.</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2737</link>
    <description>&lt;pre&gt;This patch adds the 'leaf' GCC attribute to the list of ignored
attributes.  Glibc uses this attribute causing the following
warnings in userspace projects:

  /usr/include/stdlib.h:514:26: error: attribute '__leaf__': unknown attribute

Signed-off-by: Ethan Jackson &amp;lt;ethan&amp;lt; at &amp;gt;nicira.com&amp;gt;
---
 ident-list.h |    2 ++
 parse.c      |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ident-list.h b/ident-list.h
index b12d172..35ac6bd 100644
--- a/ident-list.h
+++ b/ident-list.h
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -88,6 +88,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; IDENT(dllimport); IDENT(__dllimport__);
 IDENT(dllexport); IDENT(__dllexport__);
 IDENT(restrict); IDENT(__restrict);
 IDENT(artificial); IDENT(__artificial__);
+IDENT(leaf); IDENT(__leaf__);
+
 
 /* Preprocessor idents.  Direct use of __IDENT avoids mentioning the keyword
  * itself by name, preventing these tokens from expanding when compiling
diff --git a/parse.c b/parse.c
index bd42180..f8ade3e 100644
--- a/parse.c
+++ b/parse.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -519,6 +519,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; const char *ignored_attributes[] = {
 "__format_arg__",
 "hot",
 "__hot__",
+        "leaf",
+        "__leaf__",
 "l1_text",
 "__l1_text__",
 "l1_data",
&lt;/pre&gt;</description>
    <dc:creator>Ethan Jackson</dc:creator>
    <dc:date>2012-01-17T22:47:11</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2730">
    <title>[PATCH 1/3] sparse, llvm: Use LLVMInt1Type() in sym_basetype_type()</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2730</link>
    <description>&lt;pre&gt;In preparation for reverting commit 2ded1e7 ("sparse: Bump up sizeof(_Bool) to
8 bits"), teach sym_basetype_type() about LLVMInt1Type().

Cc: Christopher Li &amp;lt;sparse&amp;lt; at &amp;gt;chrisli.org&amp;gt;
Cc: Jeff Garzik &amp;lt;jgarzik&amp;lt; at &amp;gt;redhat.com&amp;gt;
Cc: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
Signed-off-by: Pekka Enberg &amp;lt;penberg&amp;lt; at &amp;gt;kernel.org&amp;gt;
---
 sparse-llvm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index 38f40fc..a291a0d 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -175,6 +175,9 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static LLVMTypeRef sym_basetype_type(struct symbol *sym)
 }
 } else {
 switch (sym-&amp;gt;bit_size) {
+case 1:
+ret = LLVMInt1Type();
+break;
 case -1:/* 'void *' is treated like 'char *' */
 case 8:
 ret = LLVMInt8Type();
&lt;/pre&gt;</description>
    <dc:creator>Pekka Enberg</dc:creator>
    <dc:date>2011-12-21T09:25:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2726">
    <title>Sparse 0.4.4 is released</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2726</link>
    <description>&lt;pre&gt;This is a long due release. The sparse 0.4.4 can be downloaded from:

http://www.kernel.org/pub/software/devel/sparse/dist/

The new sparse has a lot of bugs fixes. It will report less noise
while checking the new kernel tree. It compiles better with the
new gcc as well.

The sparse project is in the process of moving to the MIT license.
Dan is coordinating the efforts. Most sparse developers sign off
the MIT license already. If you haven't done so, please contact
Dan off the list regarding the new license.

Here is the short summery of the changes in this release.

Have a nice long week end.

Chris


Ben Pfaff (1):
      evaluate: Allow sizeof(_Bool) to succeed.

Christopher Li (13):
      inspect: adding function arugument list
      Allow overwrite CFLAGS from command line
      Ignore attribute vector_size
      Remove set but not used variable
      inspect: Add switch statement and more
      validation: inline switch statement
      Fix inlining switch statement.
      Sparse 0.4.4-rc1
      Add test case for empty asm clobbers
      Fix parsing empty asm clobber
      Sparse 0.4.4-rc2
      Add test case for binary constants
      sparse 0.4.4

Dan Carpenter (1):
      recognize binary constants

Diego Elio Pettenò (3):
      build: allow easy override of GCC_BASE
      build: add an all-installable target that builds the targets to install.
      Fix build with GCC 4.6 series.

Florian Fainelli (1):
      Makefile: warn user when libxml and/or libgtk2 are not available

Jan Pokorný (4):
      remove unused "container" macro
      flow.c: make comment for `dominates' reflect code
      use ARRAY_SIZE() when possible (continued)
      parse.c: "if(" -&amp;gt; "if (" adjustment

Jonathan Neuschäfer (3):
      fix a memory leak in compile-i386.c
      FAQ: fix a typo ("because or")
      fix common misspellings with codespell

Kamil Dudka (2):
      cse: treat PHI-nodes as other instructions
      cse: update PHI users when throwing away an instruction

Linus Torvalds (5):
      Add new streams to a hash-list based on their names
      Teach 'already_tokenized()' to use the stream name hash table
      Make 'linearize_iterator()' helper function
      Make 'linearize_switch()' helper function
      Make 'linearize_return()' helper function

Michael Stefaniuc (1):
      Ignore the ms_hook_prologue attribute.

Namhyung Kim (3):
      use ARRAY_SIZE() when possible
      Fix tokenizer for octal escape sequences
      Update the validation check for escape sequences

Nicolas Kaiser (1):
      memops.c: always true expression

Pekka Enberg (4):
      sparse: Add 'artifical' to ignore attributes
      sparse: Enable unhandled validation tests
      Show expected vs. actual output on test failure
      sparse: Fix __builtin_safe_p for pure and const functions
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Christopher Li</dc:creator>
    <dc:date>2011-11-25T21:13:33</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2718">
    <title>[GIT PULL] Sparse LLVM backend</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2718</link>
    <description>&lt;pre&gt;Hi Chris,

Please consider pulling latest LLVM backend code from:

   git://github.com/penberg/sparse-llvm.git for-chris

The backend is still work in progress but it already supports the following C
language features:

   - Arithmetic operations

   - Comparison operations

   - Logical operations

   - Bitwise operations

   - Loops

   - Casts

   - Structs and unions

The backend has been tested on i386 and x86-64. Some features have also been
tested on PPC against LLVM 2.6.

Please note that sparse uses 32-bit data type sizes by default so the generated
code on 64-bit is not correct. We'd need something like the following patch to
fix it:

   http://thread.gmane.org/gmane.comp.parsers.sparse/2654/focus=2655

 Pekka

------------------&amp;gt;


The following changes since commit 65a4e2fc656aa6e99604358056d8599a1823a8bc:

   sparse 0.4.4 (2011-11-21 01:56:02 -0800)

are available in the git repository at:
   git://github.com/penberg/sparse-llvm.git for-chris

Christopher Li (1):
       Limit usage of g++ to llvm related programs.

Jeff Garzik (15):
       sparse, llvm: if-else code generation
       sparse-llvm: OP_SEL
       sparse-llvm: OP_SWITCH
       sparse-llvm: OP_LOAD
       sparse-llvm OP_PHISOURCE: replace copy with target=src pointer operation
       sparse, llvm: replace FIXME comment with assert(), following existing style
       sparse, llvm: implement OP_CALL
       sparse, llvm: move OP_PHI code from switch statement to separate function
       sparse, llvm: move OP_CAST code to separate func.  support FP casts.
       sparse, llvm: create helper for obtaining instruction's type
       sparse, llvm: store module-local functions on function reference list
       sparse, llvm: move OP_COPY support to separate function.  Add FP support.
       sparse, llvm: support OP_STORE
       sparse, llvm: Fix loops, by properly handling OP_PHI forward references
       sparse, llvm: add loop testcase

Kamil Dudka (2):
       cse: treat PHI-nodes as other instructions
       cse: update PHI users when throwing away an instruction

Pekka Enberg (59):
       sparse, llvm: Initial commit
       sparse, llvm: Fix assert() in sparse code
       sparse, llvm: Fix global variable initialization
       sparse, llvm: Fix 'sparsec' when it's not in PATH
       llvm, sparse: Separate entry and exit basic blocks
       sparse, llvm: Add switch statement to output_insn()
       sparse, llvm: OP_RET/PSEUDO_VAL code generation
       sparse, llvm: Add support for OP_RET/PSEUDO_ARG
       sparse, llvm: Introduce 'struct function' to clean up code
       sparse, llvm: Add output_op_binary() stub
       sparse, llvm: Implement OP_ADD
       sparse, llvm: Add support for more binary ops
       sparse, llvm: Implement some binary comparison ops
       sparse, llvm: Move binop tests to validation/backend
       sparse, llvm: Implement OP_CAST
       sparse, llvm: Floating point support for binops
       sparse, llvm: Reorganize code generation tests
       sparse, llvm: Bitwise not operator codegen
       sparse, llvm: Kill ifdef'd unssa() call
       sparse, llvm: Kill debugging code
       Merge pull request #1 from jgarzik/hacks
       Merge pull request #2 from jgarzik/hacks
       sparse, llvm: Warn the user when we fall back to GCC
       sparse, llvm: Code generation for string constants
       sparse, llvm: Cleanup output_data()
       sparse, llvm: Fix OP_CAST to use zero-extend
       sparse, llvm: Improve sparsec front-end
       sparse, llvm: Fix PSEUDO_OP code generation
       sparse, llvm: Don't redefine module local functions
       Revert "sparse, llvm: Don't redefine module local functions"
       sparse, llvm: Fix code generation for casts
       sparse, llvm: Fix pseudo_type() for PSEUDO_ARG
       Merge pull request #3 from jgarzik/hacks
       Merge branch 'master' of github.com:penberg/sparse-llvm
       llvm, sparse: Fix symbol_is_fp_type() goof
       Merge pull request #4 from jgarzik/hacks
       sparse, llvm: Fix code generation for 'long double' data type
       sparse, llvm: Add support for struct types
       sparse, llvm: Add support for symbol initializers
       sparse: Bump up sizeof(_Bool) to 8 bits
       sparse, llvm: Add support for logical ops
       sparse, llvm: Fix 'void *' pointer code generation
       sparse, llvm: Use new LLVM type system API for structs
       sparse, llvm: Fix struct code generation
       sparse, llvm: Fix symbol_type() for bitfields and enums
       sparse, llvm: Add support for array types
       sparse, llvm: Add support for union types
       sparse, llvm: Make 'sparsec' error handling more robust
       sparse, llvm: Function pointer code generation
       sparse, llvm: Fix symbol initializer code generation
       sparse, llvm: Fix 'extern' symbol code generation
       sparse, llvm: Make llc output to stdout in sparsec
       sparse, llvm: Pointer cast code generation
       sparse, llvm: OP_SET_B and OP_SET_A code generation
       sparse, llvm: More comparison ops code generation
       sparse, llvm: Simplify comparison op code generation
       sparse, llvm: FP comparison op code generation
       Merge pull request #6 from jgarzik/hacks
       sparse, llvm: Don't fail the build if LLVM is too old

  .gitignore                          |    1 +
  Makefile                            |   26 +-
  cse.c                               |   20 +-
  linearize.h                         |    2 +
  sparse-llvm.c                       | 1238 +++++++++++++++++++++++++++++++++++
  sparsec                             |   52 ++
  target.c                            |    2 +-
  validation/backend/arithmetic-ops.c |   94 +++
  validation/backend/array.c          |    6 +
  validation/backend/bitwise-ops.c    |   64 ++
  validation/backend/cast.c           |   47 ++
  validation/backend/cmp-ops.c        |   84 +++
  validation/backend/function-ptr.c   |   11 +
  validation/backend/hello.c          |   13 +
  validation/backend/logical-ops.c    |   24 +
  validation/backend/loop.c           |   21 +
  validation/backend/ptrcast.c        |    9 +
  validation/backend/struct.c         |   19 +
  validation/backend/union.c          |   12 +
  validation/sizeof-bool.c            |    6 +-
  20 files changed, 1737 insertions(+), 14 deletions(-)
  create mode 100644 sparse-llvm.c
  create mode 100755 sparsec
  create mode 100644 validation/backend/arithmetic-ops.c
  create mode 100644 validation/backend/array.c
  create mode 100644 validation/backend/bitwise-ops.c
  create mode 100644 validation/backend/cast.c
  create mode 100644 validation/backend/cmp-ops.c
  create mode 100644 validation/backend/function-ptr.c
  create mode 100644 validation/backend/hello.c
  create mode 100644 validation/backend/logical-ops.c
  create mode 100644 validation/backend/loop.c
  create mode 100644 validation/backend/ptrcast.c
  create mode 100644 validation/backend/struct.c
  create mode 100644 validation/backend/union.c

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo&amp;lt; at &amp;gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

&lt;/pre&gt;</description>
    <dc:creator>Pekka Enberg</dc:creator>
    <dc:date>2011-11-25T07:46:06</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2717">
    <title>[PATCH] sparse, llvm: Don't fail the build if LLVM is too old</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2717</link>
    <description>&lt;pre&gt;Disable sparse-llvm compilation if LLVM version is too old.

Cc: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
Cc: Christopher Li &amp;lt;sparse&amp;lt; at &amp;gt;chrisli.org&amp;gt;
Cc: Jeff Garzik &amp;lt;jgarzik&amp;lt; at &amp;gt;redhat.com&amp;gt;
Signed-off-by: Pekka Enberg &amp;lt;penberg&amp;lt; at &amp;gt;kernel.org&amp;gt;
---
 Makefile |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index e508cae..2b5976d 100644
--- a/Makefile
+++ b/Makefile
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -23,6 +23,8 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; HAVE_GCC_DEP:=$(shell touch .gcc-test.c &amp;amp;&amp;amp; \
 echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c)
 HAVE_GTK2:=$(shell pkg-config --exists gtk+-2.0 2&amp;gt;/dev/null &amp;amp;&amp;amp; echo 'yes')
 HAVE_LLVM:=$(shell llvm-config --version &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; echo 'yes')
+HAVE_LLVM_VERSION:=$(shell llvm-config --version | grep "^[3-9].*" &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;amp; echo yes)
+LLVM_VERSION=$(shell llvm-config --version)
 
 GCC_BASE = $(shell $(CC) --print-file-name=)
 BASIC_CFLAGS = -DGCC_BASE=\"$(GCC_BASE)\"
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -65,7 +67,13 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; else
 $(warning Your system does not have libgtk2, disabling test-inspect)
 endif
 
-ifeq ($(HAVE_LLVM),yes)
+ifneq ($(HAVE_LLVM),yes)
+$(warning Your system does not have llvm, disabling sparse-llvm)
+else
+ifneq ($(HAVE_LLVM_VERSION),yes)
+$(warning LLVM 3.0 or later required. Your system has version $(LLVM_VERSION) installed.)
+HAVE_LLVM=no
+else
 LLVM_PROGS := sparse-llvm
 $(LLVM_PROGS): LD := g++
 LDFLAGS += $(shell llvm-config --ldflags)
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -76,8 +84,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; INST_PROGRAMS += sparse-llvm sparsec
 sparse-llvm_EXTRA_DEPS := sparse-llvm.o
 sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
 sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS)
-else
-$(warning Your system does not have llvm, disabling sparse-llvm)
+endif
 endif
 
 LIB_H=    token.h parse.h lib.h symbol.h scope.h expression.h target.h \
&lt;/pre&gt;</description>
    <dc:creator>Pekka Enberg</dc:creator>
    <dc:date>2011-11-25T07:06:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.parsers.sparse/2702">
    <title>[PATCH] sparse, llvm: FP comparison op code generation</title>
    <link>http://comments.gmane.org/gmane.comp.parsers.sparse/2702</link>
    <description>&lt;pre&gt;This patch implements code generation for floating point versions of OP_BINCMP.

Cc: Linus Torvalds &amp;lt;torvalds&amp;lt; at &amp;gt;linux-foundation.org&amp;gt;
Cc: Christopher Li &amp;lt;sparse&amp;lt; at &amp;gt;chrisli.org&amp;gt;
Cc: Jeff Garzik &amp;lt;jgarzik&amp;lt; at &amp;gt;redhat.com&amp;gt;
Signed-off-by: Pekka Enberg &amp;lt;penberg&amp;lt; at &amp;gt;kernel.org&amp;gt;
---
 sparse-llvm.c                |   29 +++++++++++++++++++++++++++--
 validation/backend/cmp-ops.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index 4ef02a1..0674ef3 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -391,6 +391,25 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static LLVMTypeRef pseudo_type(struct function *fn, struct instruction *insn, ps
 return result;
 }
 
+static LLVMRealPredicate translate_fop(int opcode)
+{
+static const LLVMRealPredicate trans_tbl[] = {
+[OP_SET_EQ]= LLVMRealOEQ,
+[OP_SET_NE]= LLVMRealUNE,
+[OP_SET_LE]= LLVMRealOLE,
+[OP_SET_GE]= LLVMRealOGE,
+[OP_SET_LT]= LLVMRealOLT,
+[OP_SET_GT]= LLVMRealOGT,
+/* Are these used with FP? */
+[OP_SET_B]= LLVMRealOLT,
+[OP_SET_A]= LLVMRealOGT,
+[OP_SET_BE]= LLVMRealOLE,
+[OP_SET_AE]= LLVMRealOGE,
+};
+
+return trans_tbl[opcode];
+}
+
 static LLVMIntPredicate translate_op(int opcode)
 {
 static const LLVMIntPredicate trans_tbl[] = {
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -512,9 +531,15 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static void output_op_binary(struct function *fn, struct instruction *insn)
 
 /* Binary comparison */
 case OP_BINCMP ... OP_BINCMP_END: {
-LLVMIntPredicate op = translate_op(insn-&amp;gt;opcode);
+if (LLVMGetTypeKind(LLVMTypeOf(lhs)) == LLVMIntegerTypeKind) {
+LLVMIntPredicate op = translate_op(insn-&amp;gt;opcode);
 
-target = LLVMBuildICmp(fn-&amp;gt;builder, op, lhs, rhs, target_name);
+target = LLVMBuildICmp(fn-&amp;gt;builder, op, lhs, rhs, target_name);
+} else {
+LLVMRealPredicate op = translate_fop(insn-&amp;gt;opcode);
+
+target = LLVMBuildFCmp(fn-&amp;gt;builder, op, lhs, rhs, target_name);
+}
 break;
 }
 default:
diff --git a/validation/backend/cmp-ops.c b/validation/backend/cmp-ops.c
index 7bbc81c..a5f736d 100644
--- a/validation/backend/cmp-ops.c
+++ b/validation/backend/cmp-ops.c
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -48,6 +48,36 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; static int setae(unsigned int x, unsigned int y)
 return x &amp;gt;= y;
 }
 
+static int setfe(float x, float y)
+{
+return x == y;
+}
+
+static int setfne(float x, float y)
+{
+return x != y;
+}
+
+static int setfl(float x, float y)
+{
+return x &amp;lt; y;
+}
+
+static int setfg(float x, float y)
+{
+return x &amp;gt; y;
+}
+
+static int setfle(float x, float y)
+{
+return x &amp;lt;= y;
+}
+
+static int setfge(float x, float y)
+{
+return x &amp;gt;= y;
+}
+
 /*
  * check-name: Comparison operator code generation
  * check-command: ./sparsec -c $file -o tmp.o
&lt;/pre&gt;</description>
    <dc:creator>Pekka Enberg</dc:creator>
    <dc:date>2011-11-22T19:53:41</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.parsers.sparse">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.parsers.sparse</link>
  </textinput>
</rdf:RDF>

