Fix WIDTH warnings on comparisons with nullptr (#2602).
This commit is contained in:
parent
25593c0ee2
commit
4cec3ff2a0
2
Changes
2
Changes
|
|
@ -6,6 +6,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||||
|
|
||||||
**** Support queue slicing (#2326).
|
**** Support queue slicing (#2326).
|
||||||
|
|
||||||
|
**** Fix WIDTH warnings on comparisons with nullptr (#2602). [Rupert Swarbrick]
|
||||||
|
|
||||||
|
|
||||||
* Verilator 4.102 2020-10-15
|
* Verilator 4.102 2020-10-15
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4781,6 +4781,12 @@ private:
|
||||||
= new AstNeqD(nodep->fileline(), underp,
|
= new AstNeqD(nodep->fileline(), underp,
|
||||||
new AstConst(nodep->fileline(), AstConst::RealDouble(), 0.0));
|
new AstConst(nodep->fileline(), AstConst::RealDouble(), 0.0));
|
||||||
linker.relink(newp);
|
linker.relink(newp);
|
||||||
|
} else if (VN_IS(underp->dtypep(), ClassRefDType)
|
||||||
|
|| (VN_IS(underp->dtypep(), BasicDType)
|
||||||
|
&& VN_CAST(underp->dtypep(), BasicDType)->keyword()
|
||||||
|
== AstBasicDTypeKwd::CHANDLE)) {
|
||||||
|
// Allow warning-free "if (handle)"
|
||||||
|
VL_DO_DANGLING(fixWidthReduce(underp), underp); // Changed
|
||||||
} else if (!underp->dtypep()->basicp()) {
|
} else if (!underp->dtypep()->basicp()) {
|
||||||
nodep->v3error("Logical operator " << nodep->prettyTypeName()
|
nodep->v3error("Logical operator " << nodep->prettyTypeName()
|
||||||
<< " expects a non-complex data type on the "
|
<< " expects a non-complex data type on the "
|
||||||
|
|
|
||||||
|
|
@ -4228,7 +4228,7 @@ expr<nodep>: // IEEE: part of expression/constant_expression/primary
|
||||||
// // Indistinguishable from function_subroutine_call:method_call
|
// // Indistinguishable from function_subroutine_call:method_call
|
||||||
//
|
//
|
||||||
| '$' { $$ = new AstUnbounded($<fl>1); }
|
| '$' { $$ = new AstUnbounded($<fl>1); }
|
||||||
| yNULL { $$ = new AstConst($1, AstConst::LogicFalse()); }
|
| yNULL { $$ = new AstConst($1, AstConst::StringToParse(), "'0"); }
|
||||||
// // IEEE: yTHIS
|
// // IEEE: yTHIS
|
||||||
// // See exprScope
|
// // See exprScope
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,11 @@ module t (/*AUTOARG*/);
|
||||||
initial begin
|
initial begin
|
||||||
Cls c;
|
Cls c;
|
||||||
if (c != null) $stop;
|
if (c != null) $stop;
|
||||||
|
if (c) $stop;
|
||||||
$display("Display: null = \"%p\"", c); // null
|
$display("Display: null = \"%p\"", c); // null
|
||||||
c = new;
|
c = new;
|
||||||
|
if (c == null) $stop;
|
||||||
|
if (!c) $stop;
|
||||||
$display("Display: newed = \"%p\"", c); // '{imembera:0, imemberb:0}
|
$display("Display: newed = \"%p\"", c); // '{imembera:0, imemberb:0}
|
||||||
c.imembera = 10;
|
c.imembera = 10;
|
||||||
c.imemberb = 20;
|
c.imemberb = 20;
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,11 @@ module t (/*AUTOARG*/);
|
||||||
d_time = $time;
|
d_time = $time;
|
||||||
if ($time !== d_time) $stop;
|
if ($time !== d_time) $stop;
|
||||||
|
|
||||||
|
// Null checks
|
||||||
|
d_chandle = null;
|
||||||
|
if (d_chandle != null) $stop;
|
||||||
|
if (d_chandle) $stop;
|
||||||
|
|
||||||
$write("*-* All Finished *-*\n");
|
$write("*-* All Finished *-*\n");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue