Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html>
<head>
<title>simple.c</title>
<style type="text/css">
 body { color:#000000; background-color:#ffffff }
 body { font-family:Helvetica, sans-serif; font-size:10pt }
 h1 { font-size:14pt }
 .code { border-collapse:collapse; width:100%; }
 .code { font-family: "Monospace", monospace; font-size:10pt }
 .code { line-height: 1.2em }
 .comment { color: green; font-style: oblique }
 .keyword { color: blue }
 .string_literal { color: red }
 .directive { color: darkmagenta }
 .expansion { display: none; }
 .macro:hover .expansion { display: block; border: 2px solid #FF0000; padding: 2px; background-color:#FFF0F0; font-weight: normal;   -webkit-border-radius:5px;  -webkit-box-shadow:1px 1px 7px #000; position: absolute; top: -1em; left:10em; z-index: 1 } 
 .macro { color: darkmagenta; background-color:LemonChiffon; position: relative }
 .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }
 .num { text-align:right; font-size:8pt }
 .num { color:#444444 }
 .line { padding-left: 1ex; border-left: 3px solid #ccc }
 .line { white-space: pre }
 .msg { -webkit-box-shadow:1px 1px 7px #000 }
 .msg { -webkit-border-radius:5px }
 .msg { font-family:Helvetica, sans-serif; font-size:8pt }
 .msg { float:left }
 .msg { padding:0.25em 1ex 0.25em 1ex }
 .msg { margin-top:10px; margin-bottom:10px }
 .msg { font-weight:bold }
 .msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap }
 .msgT { padding:0x; spacing:0x }
 .msgEvent { background-color:#fff8b4; color:#000000 }
 .msgControl { background-color:#bbbbbb; color:#000000 }
 .mrange { background-color:#dfddf3 }
 .mrange { border-bottom:1px solid #6F9DBE }
 .PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; }
 .PathIndex { -webkit-border-radius:8px }
 .PathIndexEvent { background-color:#bfba87 }
 .PathIndexControl { background-color:#8c8c8c }
 .PathNav a { text-decoration:none; font-size: larger }
 .CodeInsertionHint { font-weight: bold; background-color: #10dd10 }
 .CodeRemovalHint { background-color:#de1010 }
 .CodeRemovalHint { border-bottom:1px solid #6F9DBE }
 table.simpletable {
   padding: 5px;
   font-size:12pt;
   margin:20px;
   border-collapse: collapse; border-spacing: 0px;
 }
 td.rowname {
   text-align:right; font-weight:bold; color:#444444;
   padding-right:2ex; }
</style>
</head>
<body>
<!-- BUGDESC Branch condition evaluates to a garbage value -->
<!-- BUGTYPE Branch condition evaluates to a garbage value -->
<!-- BUGCATEGORY Logic error -->
<!-- BUGFILE /tmp/simple.c -->
<!-- FILENAME simple.c -->
<!-- FUNCTIONNAME f -->
<!-- BUGLINE 14 -->
<!-- BUGCOLUMN 6 -->
<!-- BUGPATHLENGTH 7 -->
<!-- BUGMETAEND -->
<!-- REPORTHEADER -->
<h3>Bug Summary</h3>
<table class="simpletable">
<tr><td class="rowname">File:</td><td>/tmp/simple.c</td></tr>
<tr><td class="rowname">Location:</td><td><a href="#EndPath">line 14, column 6</a></td></tr>
<tr><td class="rowname">Description:</td><td>Branch condition evaluates to a garbage value</td></tr>
<tr><td class="rowname">Local Path to Bug:</td><td></td></tr>
</table>
<!-- REPORTSUMMARYEXTRA -->
<h3>Annotated Source Code</h3>
<table class="code">
<tr><td class="num" id="LN1">1</td><td class="line"><span class='keyword'>extern</span> <span class='keyword'>void</span> printInt(<span class='keyword'>int</span> x); <span class='comment'>// prints int</span></td></tr>
<tr><td class="num" id="LN2">2</td><td class="line"> </td></tr>
<tr><td class="num" id="LN3">3</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>int</span> zero = 0;</td></tr>
<tr><td class="num" id="LN4">4</td><td class="line"> </td></tr>
<tr><td class="num" id="LN5">5</td><td class="line"><span class='keyword'>void</span> f() {</td></tr>
<tr><td class="num" id="LN6">6</td><td class="line">   <span class="mrange"><span class='keyword'>int</span> x</span>;</td></tr>
<tr><td class="num"></td><td class="line"><div id="Path2" class="msg msgEvent" style="margin-left:4ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">2</div></td><td><div class="PathNav"><a href="#Path1" title="Previous event (1)">&#x2190;</a></div></td></td><td>'x' declared without an initial value</td><td><div class="PathNav"><a href="#Path3" title="Next event (3)">&#x2192;</a></div></td></tr></table></div></td></tr>
<tr><td class="num" id="LN7">7</td><td class="line">   <span class='keyword'>if</span> (<span class="mrange">zero != 0</span>) {</td></tr>
<tr><td class="num"></td><td class="line"><div id="Path3" class="msg msgEvent" style="margin-left:8ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">3</div></td><td><div class="PathNav"><a href="#Path2" title="Previous event (2)">&#x2190;</a></div></td></td><td>Assuming 'zero' is not equal to 0</td><td><div class="PathNav"><a href="#Path4" title="Next event (4)">&#x2192;</a></div></td></tr></table></div></td></tr>
<tr><td class="num"></td><td class="line"><div id="Path4" class="msg msgControl" style="margin-left:4ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">4</div></td><td><div class="PathNav"><a href="#Path3" title="Previous event (3)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path5" title="Next event (5)">&#x2192;</a></div></td></tr></table></div></td></tr>
<tr><td class="num" id="LN8">8</td><td class="line">    printInt(0); <span class='comment'>// dead code</span></td></tr>
<tr><td class="num" id="LN9">9</td><td class="line">   }</td></tr>
<tr><td class="num" id="LN10">10</td><td class="line">   <span class='keyword'>else</span> {</td></tr>
<tr><td class="num" id="LN11">11</td><td class="line">  x = 0;</td></tr>
<tr><td class="num" id="LN12">12</td><td class="line">   }</td></tr>
<tr><td class="num" id="LN13">13</td><td class="line">   <span class='keyword'>if</span> (<span class="mrange">zero == 0</span>) {</td></tr>
<tr><td class="num"></td><td class="line"><div id="Path5" class="msg msgEvent" style="margin-left:8ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">5</div></td><td><div class="PathNav"><a href="#Path4" title="Previous event (4)">&#x2190;</a></div></td></td><td>Assuming 'zero' is equal to 0</td><td><div class="PathNav"><a href="#Path6" title="Next event (6)">&#x2192;</a></div></td></tr></table></div></td></tr>
<tr><td class="num"></td><td class="line"><div id="Path6" class="msg msgControl" style="margin-left:4ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">6</div></td><td><div class="PathNav"><a href="#Path5" title="Previous event (5)">&#x2190;</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#EndPath" title="Next event (7)">&#x2192;</a></div></td></tr></table></div></td></tr>
<tr><td class="num" id="LN14">14</td><td class="line">  <span class='keyword'>if</span> (!<span class="mrange">x</span>)</td></tr>
<tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">7</div></td><td><div class="PathNav"><a href="#Path6" title="Previous event (6)">&#x2190;</a></div></td></td><td>Branch condition evaluates to a garbage value</td></tr></table></div></td></tr>
<tr><td class="num" id="LN15">15</td><td class="line">      printInt(x);</td></tr>
<tr><td class="num" id="LN16">16</td><td class="line">   }</td></tr>
<tr><td class="num" id="LN17">17</td><td class="line">}</td></tr>
<tr><td class="num" id="LN18">18</td><td class="line"> </td></tr>
<tr><td class="num" id="LN19">19</td><td class="line"><span class='keyword'>int</span> main() {</td></tr>
<tr><td class="num" id="LN20">20</td><td class="line">   <span class="mrange">f()</span>;</td></tr>
<tr><td class="num"></td><td class="line"><div id="Path1" class="msg msgEvent" style="margin-left:4ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">1</div></td><td>Calling 'f'</td><td><div class="PathNav"><a href="#Path2" title="Next event (2)">&#x2192;</a></div></td></tr></table></div></td></tr>
<tr><td class="num" id="LN21">21</td><td class="line">   <span class='keyword'>return</span> 0;</td></tr>
<tr><td class="num" id="LN22">22</td><td class="line">}</td></tr>
</table></body></html>
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers