Adding error message for when size (width) of number literal is zero
authorDiego H <diego@symbioticeda.com>
Mon, 30 Mar 2020 23:18:13 +0000 (17:18 -0600)
committerDiego H <diego@symbioticeda.com>
Mon, 30 Mar 2020 23:18:13 +0000 (17:18 -0600)
frontends/verilog/const2ast.cc

index 49281f7e79e6874bf16f3b523b28adb90c0c240c..25d2578675d40c0d035dad7783babe7634c5d439 100644 (file)
@@ -139,6 +139,10 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le
                data.resize(len_in_bits, msb);
        }
 
+       if (len_in_bits == 0)
+               log_error("Illegal integer constant size of zero in %s:%d (IEEE 1800-2012, 5.7).\n",
+                               current_filename.c_str(), get_line_num());
+
        if (len > len_in_bits)
                log_warning("Literal has a width of %d bit, but value requires %d bit. (%s:%d)\n",
                        len_in_bits, len, current_filename.c_str(), get_line_num());