<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Embedded in Academia</title>
	
	<link>http://blog.regehr.org</link>
	<description />
	<lastBuildDate>Fri, 18 May 2012 01:39:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/EmbeddedInAcademia" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="embeddedinacademia" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Software Testing Using Function/Inverse Pairs</title>
		<link>http://blog.regehr.org/archives/708</link>
		<comments>http://blog.regehr.org/archives/708#comments</comments>
		<pubDate>Fri, 18 May 2012 01:34:49 +0000</pubDate>
		<dc:creator>regehr</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Software Correctness]]></category>

		<guid isPermaLink="false">http://blog.regehr.org/?p=708</guid>
		<description><![CDATA[One of the hardest problems in software testing is finding convenient, strong oracles&#8212;programs that can tell us whether the software under test worked correctly. Weak oracles, such as checking to make sure a program doesn&#8217;t crash, are always available, but not always of much use. An example of a strong oracle would be a reference [...]]]></description>
			<content:encoded><![CDATA[<p>One of the hardest problems in software testing is finding convenient, strong oracles&#8212;programs that can tell us whether the software under test worked correctly. Weak oracles, such as checking to make sure a program doesn&#8217;t crash, are always available, but not always of much use. An example of a strong oracle would be a reference implementation.</p>
<p>Sometimes software comes in function/inverse pairs, meaning that we get a program implementing some function f and another that implements f<sup>-1</sup>. When this happens we can (ideally) make up an input x and then check to make sure that f<sup>-1</sup>(f(x))=x. Often this works only in one direction. For example, let&#8217;s consider an assembler/disassembler pair. If I take some arbitrary assembly language, assemble it, and then disassemble the resulting object code, I&#8217;m unlikely to get exactly what I started with. On the other hand, if I take some arbitrary object code, disassemble it, and then assemble the resulting assembly code, I should get back the same object code. The question is whether or not f or f<sup>-1</sup> is prepared to accept inputs in non-canonical forms. This problem can usually be solved by running a second cycle through the system. For example, Jesse Ruderman of <a href="http://www.squarefree.com/2007/08/02/introducing-jsfunfuzz/">jsfunfuzz</a> fame reports taking JavaScript code in non-canonical form, compiling and decompiling it, <a href="http://www.squarefree.com/2007/08/02/fuzzing-for-correctness/">and then doing the same thing again</a>. If the second and third versions of the program differ, a bug has been found. I don&#8217;t know how many of the impressive <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=349611">1500+ bugs</a> found by jsfunfuzz come from this method.</p>
<p>Here&#8217;s a list of common function/inverse pairs that I came up with:</p>
<ul>
<li>pickle/unpickle, or save/load, of in-memory data</li>
<li>checkpoint/restore of process or virtual machine state</li>
<li>assemble/disassemble and compile/decompile</li>
<li>encode/decode of data for transmission</li>
<li>encrypt/decrypt</li>
<li>compress/decompress, either lossless or lossy</li>
</ul>
<p>The thing I would like to learn from you readers is what other function/inverse pairs you can think of. I feel like I must be missing many.</p>
<p>This topic was suggested by Alastair Reid who additionally suggested that an assembler/disassembler pair for an architecture such as ARM could be exhaustively tested in this fashion since there are only 2<sup>32</sup> possible instruction words. Very cool!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.regehr.org/archives/708/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Udacity Visit</title>
		<link>http://blog.regehr.org/archives/706</link>
		<comments>http://blog.regehr.org/archives/706#comments</comments>
		<pubDate>Thu, 26 Apr 2012 19:00:53 +0000</pubDate>
		<dc:creator>regehr</dc:creator>
				<category><![CDATA[Academia]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Education]]></category>

		<guid isPermaLink="false">http://blog.regehr.org/?p=706</guid>
		<description><![CDATA[Yesterday I took a day trip to Palo Alto to visit Udacity where I&#8217;m getting ready to teach a course on software testing. The goal was to become familiar with the recording setup, hash out any infrastructure issues, and try to refine my course content&#8211;which right now is just a collection of rough notes. Originally I had [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I took a day trip to Palo Alto to visit <a href="http://www.udacity.com/">Udacity</a> where I&#8217;m getting ready to teach a course on software testing. The goal was to become familiar with the recording setup, hash out any infrastructure issues, and try to refine my course content&#8211;which right now is just a collection of rough notes. Originally I had wanted to teach a class mainly about random testing, a topic I feel very strongly about. However, as I started getting the material together it became clear that &#8220;regular&#8221; testing was going to eat up probably half of the course slots&#8211;there is simply a giant amount of material to cover. So far I have deliberately avoided looking at anyone else&#8217;s course material, but probably I&#8217;ll need to start looking around since there are almost certainly gaps in my material that want to be filled.</p>
<p>My motivation for working with Udacity is that I&#8217;ve been disenchanted with traditional lecture courses for some time and have been nosing around for alternatives. The Udacity format&#8211;an hour or so of lecture material per week, broken into bite-sized pieces punctuated by little quizzes&#8211;seems like a good alternative. Certainly it&#8217;s a good match for my own very short attention span, and I&#8217;ve been enjoying the &#8220;applied cryptography&#8221; and &#8220;programming a robotic car&#8221; lectures, having somehow completely dodged both crypto and AI back when I was in school.</p>
<p>One thing that I really like about Udacity&#8217;s setup is that the course content is released under the Creative Commons license. This means that, for example, in the future I&#8217;ll be able to teach a software testing class at Utah where students watch the Udacity lecture material online, and we spend class time doing something more productive than listening to me talk. This is an idea I&#8217;m pretty excited about and <a href="http://blog.regehr.org/archives/145">that I&#8217;ve toyed with</a> for a couple of years.</p>
<p>On arriving at Udacity I chatted with <a href="http://www.cs.virginia.edu/~evans/">Dave Evans</a> for a little while and then spent maybe half an hour watching Steve Huffman record content for his <a href="http://www.udacity.com/overview/Course/cs253/CourseRev/apr2012">Web Application Engineering</a> course. Steve is one of the guys behind Reddit and Hipmunk. He answered a few questions I had and it was super useful watching him record&#8211;there&#8217;s a lot of editing that happens between recording and distribution of these lectures and it wasn&#8217;t at all intuitive to me what impact this has on delivery style. For example, it&#8217;s perfectly OK to stop talking in order to focus on drawing a diagram on the tablet. A cute trick: if you take a bathroom break, it&#8217;s helpful to draw a little icon or note on the tablet screen indicating you&#8217;re gone so that an editor can rapidly and easily identify and discard the resulting useless segment of video.</p>
<p>We also talked about how to run the backend part of my testing course. The details aren&#8217;t all worked out yet, but what I hope we are able to do is have students implement a specification and also write a collection of test cases; then, we&#8217;ll not only rank students&#8217; solutions by their level of correctness, but we&#8217;ll also be able to rank students&#8217; ability to create test cases that break other students&#8217; code.</p>
<p>Finally, I spent about an hour in the recording room. This was humbling: I found it very hard to draw and talk at the same time&#8211;it is going to take some practice to get that right. Embarrassingly, during the 10 years I&#8217;ve been teaching I&#8217;ve never once used a chalkboard or whiteboard, so this style is new to me. The other part that will take some getting used to is interleaving lots of quizzes with the lecture content; yesterday I tried to create a quiz on the fly and the results were not good, clearly these will have to be prepped ahead of time.</p>
<p>Anyway, I&#8217;ll post more details and impressions as they arrive.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.regehr.org/archives/706/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Harris Wash, Zebra and Tunnel Slot Canyons</title>
		<link>http://blog.regehr.org/archives/703</link>
		<comments>http://blog.regehr.org/archives/703#comments</comments>
		<pubDate>Tue, 10 Apr 2012 14:40:08 +0000</pubDate>
		<dc:creator>regehr</dc:creator>
				<category><![CDATA[Outdoors]]></category>
		<category><![CDATA[Utah]]></category>

		<guid isPermaLink="false">http://blog.regehr.org/?p=703</guid>
		<description />
			<content:encoded><![CDATA[
<div class="ngg-galleryoverview" id="ngg-gallery-52-703">


	
	<!-- Thumbnails -->
		
	<div id="ngg-image-767" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/001.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="001" alt="001" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_001.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-741" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/005.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="005" alt="005" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_005.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-742" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/042.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="042" alt="042" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_042.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-744" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/049.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="049" alt="049" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_049.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-745" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/064.jpg" title="Zebra is narrow enough for even small people to practice chimneying and stemming." class="thickbox" rel="set_52" >
								<img title="064" alt="064" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_064.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-748" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/085.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="085" alt="085" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_085.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-749" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/094.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="094" alt="094" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_094.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-755" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/143.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="143" alt="143" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_143.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-766" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/114.jpg" title="Moqui marble detail. Why do they line up like this?" class="thickbox" rel="set_52" >
								<img title="114" alt="114" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_114.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-753" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/121.jpg" title="Everyone was curious about what's inside a moqui marble. Turns out it's just more sandstone." class="thickbox" rel="set_52" >
								<img title="121" alt="121" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_121.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-768" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/135.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="135" alt="135" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_135.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-758" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/165.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="165" alt="165" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_165.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-759" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/167.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="167" alt="167" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_167.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-763" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/186.jpg" title="Tunnel slot canyon: very short, but very cool. The water was almost waist-deep on me." class="thickbox" rel="set_52" >
								<img title="186" alt="186" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_186.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-764" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/194.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="194" alt="194" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_194.jpg" width="266" height="400" />
							</a>
		</div>
	</div>
	
		
 		
	<div id="ngg-image-765" class="ngg-gallery-thumbnail-box"  >
		<div class="ngg-gallery-thumbnail" >
			<a href="http://blog.regehr.org/wp-content/gallery/escalante_12/206.jpg" title=" " class="thickbox" rel="set_52" >
								<img title="206" alt="206" src="http://blog.regehr.org/wp-content/gallery/escalante_12/thumbs/thumbs_206.jpg" width="400" height="266" />
							</a>
		</div>
	</div>
	
		
 	 	
	<!-- Pagination -->
 	<div class="ngg-clear"></div> 	
</div>


]]></content:encoded>
			<wfw:commentRss>http://blog.regehr.org/archives/703/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Does Portable Byte-Order Code Optimize?</title>
		<link>http://blog.regehr.org/archives/702</link>
		<comments>http://blog.regehr.org/archives/702#comments</comments>
		<pubDate>Wed, 04 Apr 2012 18:14:45 +0000</pubDate>
		<dc:creator>regehr</dc:creator>
				<category><![CDATA[Compilers]]></category>
		<category><![CDATA[Computer Science]]></category>

		<guid isPermaLink="false">http://blog.regehr.org/?p=702</guid>
		<description><![CDATA[When reading data whose byte-ordering may differ from the host computer&#8217;s, Rob Pike advocates writing portable code as opposed to using #ifdefs to optimize the case where the encoded data&#8217;s byte ordering matches the host. His arguments seem reasonable and it&#8217;s definitely a win if the compiler can transparently recognize the useless data extraction operations [...]]]></description>
			<content:encoded><![CDATA[<p>When reading data whose byte-ordering may differ from the host computer&#8217;s, <a href="http://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html">Rob Pike advocates writing portable code</a> as opposed to using #ifdefs to optimize the case where the encoded data&#8217;s byte ordering matches the host. His arguments seem reasonable and it&#8217;s definitely a win if the compiler can transparently recognize the useless data extraction operations and optimize them away. Rob&#8217;s code is basically this:</p>
<pre class="brush: cpp; title: ; notranslate">
int read_little_endian_int (unsigned char *data)
{
  int i = 
    (data[0]&lt;&lt;0) | (data[1]&lt;&lt;8) | 
    (data[2]&lt;&lt;16) | (data[3]&lt;&lt;24);
  return i;
}
</pre>
<p>On a little-endian host, this code can be simplified to just a 32-bit load. But do compilers actually perform this optimization? It turns out not. Clang (built today from trunk) gives this:</p>
<blockquote>
<pre><strong>read_little_endian_int:</strong>
<strong> movzbl (%rdi), %ecx</strong>
<strong> movzbl 1(%rdi), %eax</strong>
<strong> shll $8, %eax</strong>
<strong> orl %ecx, %eax</strong>
<strong> movzbl 2(%rdi), %ecx</strong>
<strong> shll $16, %ecx</strong>
<strong> orl %eax, %ecx</strong>
<strong> movzbl 3(%rdi), %eax</strong>
<strong> shll $24, %eax</strong>
<strong> orl %ecx, %eax</strong>
<strong> ret</strong></pre>
</blockquote>
<p>GCC (built a few days ago) and Intel&#8217;s compiler (12.0.5) produce very similar code.</p>
<p>Does the sub-optimality of this code matter? Probably not if we&#8217;re reading from a slow device, but it does matter if we&#8217;re reading from RAM. My Core i7 920 (running in 64-bit mode) can copy a large block of data using 32-bit operations at about 7 GB/s, but reaches only about 2 GB/s when running the data through the code emitted by Clang. The results for GCC and Intel CC are similar.</p>
<p>But now the plot thickens slightly. If we wish to check that the function above is implemented and compiled correctly, we might write a program with this main function:</p>
<pre class="brush: cpp; title: ; notranslate">
int main (void)
{
  int i = INT_MIN;
  while (1) {
    int i2 = read_little_endian_int ((unsigned char *)&amp;i);
    if (i != i2) {
      printf (&quot;oops %d != %d\n&quot;, i, i2);
    }
    if (i == INT_MAX) break;
    i++;
  }
  return 0;
}
</pre>
<p>GCC and Intel CC compile this in the obvious way, but Clang (at -O3) turns this main function into a nop:</p>
<blockquote>
<pre><strong> main:
 xorl %eax, %eax
 ret
</strong></pre>
</blockquote>
<p>Now why would Clang understand that read_little_endian_int is a nop when it is used in this context, but fail to emit the obvious code for the function itself? I&#8217;m not sure what to make of this. Maybe someone familiar with LLVM&#8217;s optimizers can help out here. The full code is <a href="http://blog.regehr.org/extra_files/endian2.c">here</a> if anyone wants to play with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.regehr.org/archives/702/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>57 Small Programs that Crash Compilers</title>
		<link>http://blog.regehr.org/archives/696</link>
		<comments>http://blog.regehr.org/archives/696#comments</comments>
		<pubDate>Tue, 03 Apr 2012 20:54:34 +0000</pubDate>
		<dc:creator>regehr</dc:creator>
				<category><![CDATA[Compilers]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Software Correctness]]></category>

		<guid isPermaLink="false">http://blog.regehr.org/?p=696</guid>
		<description><![CDATA[It&#8217;s not clear how many people enjoy looking at programs that make compilers crash &#8212; but this post is for them (and me). Our paper on producing reduced test cases for compiler bugs contained a large table of results for crash bugs. Below are all of C-Reduce&#8217;s reduced programs for those bugs. Can we conclude [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not clear how many people enjoy looking at programs that make compilers crash &#8212; but this post is for them (and me).  <a href="http://www.cs.utah.edu/~regehr/papers/pldi12-preprint.pdf">Our paper</a> on producing reduced test cases for compiler bugs contained a large table of results for crash bugs. Below are all of C-Reduce&#8217;s reduced programs for those bugs.</p>
<p>Can we conclude anything just by looking at these? It&#8217;s hard to say&#8230; many of these C fragments are not obviously hard to compile &#8212; to see the problem we would need to know the details of the translation to a particular compiler&#8217;s intermediate representation.</p>
<p>In general, we don&#8217;t know of any way to make these programs much smaller. In other words, C-Reduce already implements most of the tricks we can think of. It will always be the case that an experienced compiler developer who understand a particular bug will be able to produce considerably better reduced test cases than C-Reduce can. Our goal, rather, is to create tests that a naive user cannot improve very much. So if you see interesting opportunities to improve these test cases, we&#8217;d love to hear about it. The current version of C-Reduce fails to implement optimizations such as constant folding, constant propagation, and loop peeling. We haven&#8217;t seen much need for these, though.</p>
<p>These are the verbatim tool output; there are definitely some formatting warts.</p>
<p>C1 : Crashes Clang 2.6 at -O0:</p>
<pre class="brush: cpp; title: ; notranslate">
#pragma pack(1)
struct S1 {
  int f0;
  char f2
};
struct {
  struct S1 f0
    }
a[] = { 0 }
      ;
</pre>
<p>C2 : Crashes Clang 2.6 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
struct S0 {
  int f0:1;
  int f4
}
a;
void
fn1 () {
  struct S0 b[][1][1] = { 0 };
  b[0][0][0] = a;
}
</pre>
<p>C3 : Crashes Clang 2.6 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
unsigned short a;
int b;
char c;
short
fn1 () {
  return 1 / a;
}
void
fn2 () {
  b = fn1 ();
  char d = b;
  c = d % 3;
}
</pre>
<p>C4 : Crashes Clang 2.6 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b, c, d, e;
#pragma pack(1)
struct S0 {
  int f0:14;
  int f1:13;
  int f2:28;
  int f3:23;
  int f4:12
};
void fn1 (struct S0);
void
fn2 () {
  int f;
lbl_2311:
  ;
  struct S0 g = { 0, 0, 1 };
  fn1 (g);
  b &amp;&amp; e;
  for (; c;) {
    if (d)
      goto lbl_2311;
    f = a &amp;&amp; 1 ? 0 : 1;
    g.f4 = f;
  }
}
</pre>
<p>C5 : Crashes Clang 2.6 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
 int crc32_context, g_2 = 0, g_5;
int g_8;
int *g_39, *g_371;
int g_81;
int func_1_l_15 ;
static short safe_add_func_int16_t_s_s ( short si1, int si2 ) {
    return si1 &gt; 67 ? si1 : si1 + si2;
  }

    static int func_1 (  ) {
    int l_462 = 0;
    g_2 = 0;
    for ( ;
  g_2 &lt; 12;
  g_2 = safe_add_func_int16_t_s_s ( g_2, 5 ) )     {
       g_5 = 1;
       for ( ;
 g_5;
 ++g_5 ) 	{
 	  g_8 = 1;
 	  for ( ;
 g_8 &gt;= 0;
 g_8 = g_8 - 1 ) 	    {
 	      func_1_l_15 = 1;
  	      for ( ;
 func_1_l_15;
 		    func_1_l_15 =   func_1_l_15  - 1  ) 		if ( g_8 ) 		  break;
 	    }
 	  g_371 = &amp;l_462;
 	  int *l_128 = &amp;g_81;
 	  *l_128 = *g_39;
 	}
 *g_371 =    0 != 0   ;
     }
    return 0;
  }
   int main (  ) {
    func_1 (  );
    crc32_context = g_2;
    crc32_context += g_5;
  }
  </pre>
<p>C6 : Crashes Clang 2.6 at -O0:</p>
<pre class="brush: cpp; title: ; notranslate">
#pragma pack(1)
struct S2 {
  int f1;
  short f4
};
struct S3 {
  struct S2 f1;
  int f3:14
};
struct {
  struct S3 f3
    }
a = { 0, 0, 0 };
</pre>
<p>C7 : Crashes Clang 2.6 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
int *a;
static int **b;
int c, d, e;
void
fn1 () {
  d = &amp;b == c;
  for (;;) {
    int **f = &amp;a;
    if (e) {
    } else
      b = f;
    if (**b)
      continue;
    **f;
  }
}
</pre>
<p>C8 : Crashes Clang 2.6 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
#pragma pack(1)
struct S0 {
  int f3;
  char f4
};
struct {
  struct S0 f6;
  int f8
}
a = { 0, 0, 0 };
</pre>
<p>C9 : Crashes Clang 2.6 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
struct S0 {
  int f0;
  int f1;
  short f3;
  int f7;
  int f8
}
b;
int a, c, d, e, f;
void
fn1 (struct S0 p1) {
  d++;
  c = p1.f8;
  e = 0;
  a = p1.f7;
}
void
fn2 () {
  e = 0;
  for (; e; e++) {
    if (d)
      for (;;) {
      }
    --f;
  }
  fn1 (b);
}
</pre>
<p>C10 : Crashes Clang 2.6 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
union U2 {
  int f0;
  unsigned short f2
}
b;
static int a = 1;
void
fn1 (int p1, unsigned short p2) {
}
int fn2 (union U2);
union U2 fn3 ();
static unsigned long long
fn5 () {
  fn1 (b.f2, b.f0);
  return 0;
}
static char
fn4 () {
  fn5 ();
  return 0;
}
int
main () {
  a || fn2 (fn3 (fn4 () ) );
}
</pre>
<p>C11 : Crashes Clang 2.7 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
int *a;
static int **b;
int c, d, e;
void
fn1 () {
  d = &amp;b == c;
  for (;;) {
    int **f = &amp;a;
    if (e) {
    } else
      b = f;
    if (**b)
      continue;
    **f;
  }
}
</pre>
<p>C12 : Crashes Clang 2.7 at -O0:</p>
<pre class="brush: cpp; title: ; notranslate">
char a;
unsigned char b;
int c;
void
fn1 () {
  (b ^= c) != a;
}
</pre>
<p>C13 : Crashes Clang 2.7 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
void fn1 ();
void
fn2 (short p1) {
  short c;
  c = (65532 | 3) + p1;
  fn1 (c &amp;&amp; 1);
  b = (0 == p1) * a;
}
</pre>
<p>C14 : Crashes GCC 3.2.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
void
fn1 () {
  struct S0 *a;
  struct S0 *b, *c = &amp;a;
  struct S0 **d = &amp;c;
  if (&amp;b == &amp;a) {
  }
}
</pre>
<p>C15 : Crashes GCC 3.2.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
volatile int a, b, c, i;
char d;
void
fn1 () {
  int e;
  {
    for (;; c++) {
      int f[50] = { };
      if (b) {
        {
          0;
          {
            {
              int g = a, h = d;
              e = h ? g : g / 0;
            }
          }
          a = e;
        }
      }
    }
  }
}
void
main () {
  i = 0 / 0;
  a;
}
</pre>
<p>C16 : Crashes GCC 3.2.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, c;
volatile int b;
void
fn1 () {
  b;
  for (;;)
    break;
  int d = b, e = a;
  c = a ? d : d % 0;
}
void
fn2 () {
  if (0 % 0)
    b;
}
</pre>
<p>C17 : Crashes GCC 3.2.0 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
union U1 {
  int f0;
  char f1
};
void
fn1 (union U1 p1) {
  p1.f1 = 0;
  for (; p1.f1;) {
  }
}
</pre>
<p>C18 : Crashes GCC 3.2.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
void
fn1 () {
  b = 4294967290UL &lt;= a | b;
}
</pre>
<p>C19 : Crashes GCC 3.2.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b, c;
int
fn1 (int p1, int p2) {
  return p1 - p2;
}
void
fn2 () {
  int d;
  int **e;
  int ***f = &amp;e;
  d = a &amp;&amp; b ? a : a % 0;
  if (fn1 (f == 0, 2) )
    c = ***f;
}
</pre>
<p>C20 : Crashes GCC 3.3.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b, d;
struct S0 {
  int f3
};
int *volatile c;
void fn1 (struct S0);
void
fn2 () {
  int e;
  struct S0 **f;
  struct S0 ***g = &amp;f;
  (a &amp;&amp; b &amp;&amp; b ? 0 : b) &gt; (&amp;c &amp;&amp; 0);
  e = 0 == g;
  d = e &gt;&gt; 1;
  for (;;)
    fn1 (***g);
}
</pre>
<p>C21 : Crashes GCC 3.4.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
struct U0 {
  char f0;
  int f2
};
void
fn1 () {
  struct U0 c;
  for (; c.f0 != 1; c.f0 = c.f0 + a)
    b -= 1;
}
</pre>
<p>C22 : Crashes GCC 3.4.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b, d, e;
struct S0 {
  int f3
};
int *c;
void fn1 (struct S0);
void
fn2 () {
  struct S0 **f;
  struct S0 ***g = &amp;f;
  (a &amp;&amp; b &amp;&amp; b ? 0 : b) &gt; (&amp;c == d);
  e = 1 &lt; (0 == g);
  for (;;)
    fn1 (***g);
}
</pre>
<p>C23 : Crashes GCC 4.0.0 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
int ***a;
int b;
int *c;
void
main () {
  if (&amp;c == a)
    b = 0 == *a;
}
</pre>
<p>C24 : Crashes GCC 4.0.0 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
int a[][0];
int *const b = &amp;a[0][1];
int
fn1 () {
  return *b;
}
</pre>
<p>C25 : Crashes GCC 4.0.0 at -O0:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
unsigned char c;
void
fn1 () {
  (0 &gt;= a &amp; (0 || b) ) &gt; c;
}
</pre>
<p>C26 : Crashes GCC 4.0.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
struct {
  int f9:1
}
a;
const int b[] = { 0 };
void fn1 ();
void
main () {
  for (;;) {
    a.f9 = b[0];
    fn1 ();
  }
}
</pre>
<p>C27 : Crashes GCC 4.0.0 at -O0:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, c;
unsigned char b;
void
fn1 () {
  b &gt; (c &gt; 0 &amp; 0 &lt; a);
}
</pre>
<p>C28 : Crashes GCC 4.0.0 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
int **a[][0];
static int ***const b = &amp;a[0][1];
void fn1 ();
int
fn2 () {
  return ***b;
  fn1 ();
}
void
fn1 () {
  **b;
}
</pre>
<p>C29 : Crashes GCC 4.1.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
volatile int ***a;
int b;
int **c;
void
fn1 () {
  if (&amp;c == a)
    b = 0 == *a;
}
</pre>
<p>C30 : Crashes GCC 4.1.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
struct {
  int f0;
  int f2
}
a;
int b;
void
fn1 () {
  a.f2 = 0;
  int *c[] = { 0, 0, 0, 0, &amp;a.f0, 0, 0, 0, &amp;a.f0 };
  b = *c[4];
}
</pre>
<p>C31 : Crashes GCC 4.1.0 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
unsigned c;
void
fn1 () {
  for (; c &lt;= 0;)
    if (b &lt; c)
      a = 1 &amp;&amp; c;
}
</pre>
<p>C32 : Crashes GCC 4.1.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
unsigned a;
int b;
void
main () {
  unsigned c = 4294967295;
  int d = c;
  b = a &lt;= d || a;
}
</pre>
<p>C33 : Crashes GCC 4.1.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
const volatile long a;
void
main () {
  printf (&quot;%d\n&quot;, (int) a);
}
</pre>
<p>C34 : Crashes GCC 4.1.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
union U1 {
  int f0;
  int f1
};
void
fn1 () {
  union U1 c = { 1 };
  int d = 1;
  if ( (c.f1 &amp; a ? c.f1 : 1 - a) ^ d) {
  } else
    b = 0;
}
</pre>
<p>C35 : Crashes GCC 4.2.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
volatile int ***a;
int b;
int **c;
void
fn1 () {
  if (&amp;c == a)
    b = 0 == *a;
}
</pre>
<p>C36 : Crashes GCC 4.2.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
struct S2 {
  volatile int f5:1;
  int f6
};
static struct S2 a;
void
main () {
  printf (&quot;%d\n&quot;, a.f5);
}
</pre>
<p>C37 : Crashes GCC 4.3.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
long long *a;
int b;
void
fn1 () {
  long long **c = &amp;a;
  int d = 7;
lbl_2890: {
    long long **e = &amp;a;
    b = (e == c) &lt; d;
    d = 0;
    goto lbl_2890;
  }
}
</pre>
<p>C38 : Crashes GCC 4.3.0 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
struct S2 {
  volatile int f5:1;
  int f6
};
static struct S2 a;
void
main () {
  printf (&quot;%d\n&quot;, a.f5);
}
</pre>
<p>C39 : Crashes GCC 4.3.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a;
short b;
void
fn1 () {
  int c[0];
  for (;;) {
    a = c[0];
    b = 0;
    for (; b &lt; 7; b += 1)
      c[b] = 0;
  }
}
</pre>
<p>C40 : Crashes GCC 4.3.0 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
volatile int **a;
int *b;
void
fn1 () {
  if (a == &amp;b)
    **a;
}
</pre>
<p>C41 : Crashes GCC 4.3.0 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b, c, d, e, f;
void
fn1 () {
  char g;
lbl_120:
  if (b || e &gt;= 0 &amp; d &gt;= 0 || a)
    return;
  g = f &lt; 0 ? 1 : f;
  d = g == 0 || (char) f == 0 &amp;&amp; g == 1 ? 0 : 0 % 0;
  if (c)
    goto lbl_120;
}
</pre>
<p>C42 : Crashes Intel CC 12.0.5 at -O1:</p>
<pre class="brush: cpp; title: ; notranslate">
struct U0 {
  int f0
}
a;
struct U0
fn1 () {
  return a;
}
void
main () {
  0 &gt; a.f0;
  fn1 ();
}
</pre>
<p>C43 : Crashes Open64 4.2.4 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a;
int *b;
unsigned c;
void
fn1 () {
  for (; a; a--)
    if (*b) {
      c = 0;
      for (; c &gt;= 5; c++) {
      }
    }
}
</pre>
<p>C44 : Crashes Open64 4.2.4 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
short a;
void
fn1 () {
  long b;
  b = 44067713550;
  a |= b;
}
</pre>
<p>C45 : Crashes Open64 4.2.4 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
volatile int a;
void
fn1 () {
  int b = 1;
  a || b--;
}
</pre>
<p>C46 : Crashes Open64 4.2.4 at -O2:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
void fn1 ();
void fn2 ();
void
fn3 () {
  fn2 ();
  fn1 ();
}
void
fn2 () {
  if (1) {
  } else
    for (;; b++) {
      int c = 0;
      int *d = &amp;a;
      int **e = &amp;d;
      *e = &amp;c;
      *d = 0;
      *d |= 0;
    }
}
</pre>
<p>C47 : Crashes Open64 4.2.4 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
struct S0 {
  int f1:1
};
int a, b;
void
fn1 () {
  for (; b;) {
    struct S0 c = { };
    if (1) {
      c = c;
      a = c.f1;
    }
  }
}
</pre>
<p>C48 : Crashes Open64 4.2.4 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b;
int
fn1 () {
  int *c = &amp;b;
  a = 0;
  for (; a &gt;= -26; --a) {
    unsigned d = 18446744073709551615;
    int *e = &amp;b;
    *e &amp;= d;
  }
  return *c;
}
</pre>
<p>C49 : Crashes Open64 4.2.4 at -O3:</p>
<pre class="brush: cpp; title: ; notranslate">
static int a, c, d;
int b;
int *e;
void
fn1 () {
  for (; a; a += 1) {
    b = 0;
    for (; b &gt; -16; --b)
      for (; c;) {
        int *f = &amp;d;
        *f = 0;
      } *e = 0;
  }
}
</pre>
<p>C50 : Crashes Sun CC 5.11 at -xO4:</p>
<pre class="brush: cpp; title: ; notranslate">
unsigned char a, d;
struct {
  int f2
}
b;
int c, e;
void
fn1 (p1) {
}
void
fn2 () {
  c = 0;
  for (; c &lt;= 0;)
    e = b.f2;
  fn1 (0);
  b = b;
  d = -a;
}
</pre>
<p>C51 : Crashes Sun CC 5.11 at -fast:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, c;
int b[1];
void
fn1 () {
  short d;
  for (; a; a -= 1) {
    d = b1 = b1;
    b[0] = 0;
  }
}
</pre>
<p>C52 : Crashes Sun CC 5.11 at -xO4:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, b, d;
short c;
int
fn1 (p1) {
  return a ? 0 : p1;
}
void
fn2 () {
  int e = 0;
  for (;;) {
    c = 0;
    d = fn1 (e ^ ~~c);
    d &amp;&amp; b;
  }
}
</pre>
<p>C53 : Crashes Sun CC 5.11 at -fast:</p>
<pre class="brush: cpp; title: ; notranslate">
long a;
int b, d;
int *c;
void
fn1 () {
  int *e;
  for (;; b--)
    for (; d;) {
      *c = 0;
      *c &amp;= (&amp;e != 1) / a;
    }
}
</pre>
<p>C54 : Crashes Sun CC 5.11 at -xO0:</p>
<pre class="brush: cpp; title: ; notranslate">
#pragma pack(1)
struct {
  int f3:1;
  int f4:16
}
a = { 1, 0 };
</pre>
<p>C55 : Crashes Sun CC 5.11 at -xO3:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, c;
static int b = 1;
void fn1 ();
void
fn2 () {
  for (; a; a--) {
    c = 0;
    for (; c != 1;) {
      if (b)
        break;
      fn1 ();
    }
  }
}
</pre>
<p>C56 : Crashes Sun CC 5.11 at -xO4:</p>
<pre class="brush: cpp; title: ; notranslate">
#pragma pack(1)
struct S0 {
  int f1;
  int f3:1
}
a;
void
fn1 (struct S0 p1) {
  p1.f3 = 0;
}
void
fn2 () {
  fn1 (a);
}
</pre>
<p>C57 : Crashes Sun CC 5.11 at -fast:</p>
<pre class="brush: cpp; title: ; notranslate">
int a, c, d, e, f, g, h, i, j, k;
volatile int b;
int
fn1 () {
  for (; d; d = a) {
    int *l = &amp;c;
    c = -3;
    for (; c &gt; -23; --c)
      if (k) {
        if (*l)
          continue;
        return b;
      }
    for (; i; ++i) {
      j = 0;
      g = h;
      for (; f &lt;= 1; f += 1) {
      }
    }
  }
  return e;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.regehr.org/archives/696/feed</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

