Fixed a bug in the new feature of $readmem[hb] when an empty string is provided
authorRodrigo Alejandro Melo <rodrigomelo9@gmail.com>
Sat, 1 Feb 2020 20:03:56 +0000 (17:03 -0300)
committerRodrigo Alejandro Melo <rodrigomelo9@gmail.com>
Sat, 1 Feb 2020 20:03:56 +0000 (17:03 -0300)
Signed-off-by: Rodrigo Alejandro Melo <rodrigomelo9@gmail.com>
frontends/ast/simplify.cc

index 4f105eed6001bd54b96fb58da6e697b0cb3e8e2b..310f6fc3246b345740d4b535ca5cd0b307bdf0c2 100644 (file)
@@ -2894,7 +2894,7 @@ AstNode *AstNode::readmem(bool is_readmemh, std::string mem_filename, AstNode *m
        } else {
                yosys_input_files.insert(mem_filename);
        }
-       if (f.fail())
+       if (f.fail() || strlen(mem_filename.c_str()) == 0)
                log_file_error(filename, linenum, "Can not open file `%s` for %s.\n", mem_filename.c_str(), str.c_str());
 
        log_assert(GetSize(memory->children) == 2 && memory->children[1]->type == AST_RANGE && memory->children[1]->range_valid);