Fix removing if assigned to unused var, bug248.

This commit is contained in:
Wilson Snyder 2010-04-19 19:38:22 -04:00
parent 68b63d5783
commit aca4ab015f
3 changed files with 10 additions and 6 deletions

View File

@ -17,6 +17,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix bit reductions on multi-packed dimensions, bug227. [by Bryon Bradley]
**** Fix removing $fscanf if assigned to unused var, bug248. [Ashutosh Das]
**** Fix "make install" with configure outside srcdir. [Stefan Wallentowitz]
**** Fix loop unroller out of memory; change --unroll-stmts. [Ashutosh Das]

View File

@ -145,13 +145,10 @@ private:
nodep->lhsp()->iterateAndNext(*this);
}
}
virtual void visit(AstUCFunc* nodep, AstNUser*) {
m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment
nodep->iterateChildren(*this);
}
//-----
virtual void visit(AstNode* nodep, AstNUser*) {
if (nodep->isOutputter()) m_sideEffect=true;
nodep->iterateChildren(*this);
}

View File

@ -14,9 +14,14 @@ module t;
outfile = $fopen("obj_dir/t_sys_file_scan/t_sys_file_scan_test.log", "w");
count = 1234;
$display("count == %d, infile %d, outfile %d", count, infile, outfile);
`ifdef TEST_VERBOSE
$display("-count == %d, infile %d, outfile %d", count, infile, outfile);
`endif
count = $fscanf(infile, "%d\n", a);
$display("count == %d, infile %d, outfile %d", count, infile, outfile);
`ifdef TEST_VERBOSE
// Ifdefing this out gave bug248
$display("-count == %d, infile %d, outfile %d", count, infile, outfile);
`endif
$fwrite(outfile, "# a\n");
$fwrite(outfile, "%d\n", a);
$fclose(infile);