Crash or Segmentation Fault when reading DEF file
Describe the bug
When reading a DEF file, the software crashes.
Scenario: technology DATABASE MICRONS is 1000 If you change coordinates of the rectangle such that the dimensions of both axes are not divisible by 10, then the software crashes. If I change the DATABASE MICRONS to 2000, the software can read the DEF file successfully.
A sample stack trace:
OpenROAD v2.0-19779-gd4bb9505a Features included (+) or not (-): +GPU +GUI +Python This program is licensed under the BSD-3 license. See the LICENSE file for details. Components of this program may be licensed under more restrictive licenses which must be honored. openroad> read_lef sample_tech.lef read_lef cell.lef read_def sample_def.def [INFO ODB-0227] LEF file: sample_tech.lef, created 3 layers [INFO ODB-0227] LEF file: cell.lef, created 1 library cells [INFO ODB-0127] Reading DEF file: sample_def.def [INFO ODB-0128] Design: test_def Signal 11 received Stack trace: 0# 0x0000563C63775E82 in ../tools/install/OpenROAD/bin/openroad 1# 0x00007F1799945520 in /lib/x86_64-linux-gnu/libc.so.6 2# odb::dbBox::setLayerMask(unsigned int) in ../tools/install/OpenROAD/bin/openroad 3# odb::definSNet::rect(char const*, int, int, int, int, char const*, unsigned int) in ../tools/install/OpenROAD/bin/openroad 4# odb::definReader::specialNetCallback(DefParser::defrCallbackType_e, DefParser::defiNet*, void*) in ../tools/install/OpenROAD/bin/openroad 5# DefParser::defyyparse(DefParser::defrData*) in ../tools/install/OpenROAD/bin/openroad 6# DefParser::defrRead(_IO_FILE*, char const*, void*, int) in ../tools/install/OpenROAD/bin/openroad 7# odb::definReader::createBlock(char const*) in ../tools/install/OpenROAD/bin/openroad 8# odb::definReader::createChip(std::vector<odb::dbLib*, std::allocatorodb::dbLib* >&, char const*, odb::dbTech*) in ../tools/install/OpenROAD/bin/openroad 9# odb::defin::createChip(std::vector<odb::dbLib*, std::allocatorodb::dbLib* >&, char const*, odb::dbTech*) in ../tools/install/OpenROAD/bin/openroad 10# ord::OpenRoad::readDef(char const*, odb::dbTech*, bool, bool, bool, bool) in ../tools/install/OpenROAD/bin/openroad 11# read_def_cmd(char const*, char const*, bool, bool, bool, bool) in ../tools/install/OpenROAD/bin/openroad 12# 0x0000563C6380236D in ../tools/install/OpenROAD/bin/openroad 13# TclNRRunCallbacks in /lib/x86_64-linux-gnu/libtcl8.6.so 14# 0x00007F179DE97028 in /lib/x86_64-linux-gnu/libtcl8.6.so 15# Tcl_EvalEx in /lib/x86_64-linux-gnu/libtcl8.6.so 16# Tcl_Eval in /lib/x86_64-linux-gnu/libtcl8.6.so 17# 0x0000563C637752E0 in ../tools/install/OpenROAD/bin/openroad 18# Tcl_MainEx in /lib/x86_64-linux-gnu/libtcl8.6.so 19# main in ../tools/install/OpenROAD/bin/openroad 20# 0x00007F179992CD90 in /lib/x86_64-linux-gnu/libc.so.6 21# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 22# _start in ../tools/install/OpenROAD/bin/openroad Segmentation fault (core dumped)
Expected Behavior
The expected behavior is for the tool to successfully read the DEF file.
Environment
[WARNING] Your current OpenROAD version is outdated.
It is recommened to pull the latest changes.
If problem persists, file a github issue with the re-producible test case.
kernel: Linux 5.15.167.4-microsoft-standard-WSL2
os: Ubuntu 22.04.3 LTS (Jammy Jellyfish)
cmake version 3.22.1
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- OpenROAD version: v2.0-19779-gd4bb9505a
-- System name: Linux
-- Compiler: GNU 11.4.0
-- Build type: RELEASE
-- Install prefix: /usr/local
-- C++ Standard: 17
-- C++ Standard Required: ON
-- C++ Extensions: OFF
-- The C compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test C_COMPILER_SUPPORTS__-Wall
-- Performing Test C_COMPILER_SUPPORTS__-Wall - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wall
-- Performing Test CXX_COMPILER_SUPPORTS__-Wall - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-array-bounds
-- Performing Test C_COMPILER_SUPPORTS__-Wno-array-bounds - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-array-bounds
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-array-bounds - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-nonnull
-- Performing Test C_COMPILER_SUPPORTS__-Wno-nonnull - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-nonnull
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-nonnull - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-maybe-uninitialized
-- Performing Test C_COMPILER_SUPPORTS__-Wno-maybe-uninitialized - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-maybe-uninitialized
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-maybe-uninitialized - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format-overflow
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format-overflow - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format-overflow
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format-overflow - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-variable
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-variable - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-variable
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-variable - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-function
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-function - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-function
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-function - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-write-strings
-- Performing Test C_COMPILER_SUPPORTS__-Wno-write-strings - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-write-strings
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-write-strings - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-sign-compare
-- Performing Test C_COMPILER_SUPPORTS__-Wno-sign-compare - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-sign-compare
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-sign-compare - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-deprecated
-- Performing Test C_COMPILER_SUPPORTS__-Wno-deprecated - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-deprecated
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-deprecated - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-c++11-narrowing
-- Performing Test C_COMPILER_SUPPORTS__-Wno-c++11-narrowing - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-c++11-narrowing
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-c++11-narrowing - Failed
-- Performing Test C_COMPILER_SUPPORTS__-Wno-register
-- Performing Test C_COMPILER_SUPPORTS__-Wno-register - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-register
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-register - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format
-- Performing Test C_COMPILER_SUPPORTS__-Wno-format - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-format - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal
-- PerformingCMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) (Required is at
least version "4.0")
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22/Modules/FindSWIG.cmake:153 (find_package_handle_standard_args)
src/CMakeLists.txt:164 (find_package)
Test C_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-reserved-user-defined-literal - Failed
-- Performing Test C_COMPILER_SUPPORTS__-fpermissive
-- Performing Test C_COMPILER_SUPPORTS__-fpermissive - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-fpermissive
-- Performing Test CXX_COMPILER_SUPPORTS__-fpermissive - Success
-- Performing Test C_COMPILER_SUPPORTS__-x
-- Performing Test C_COMPILER_SUPPORTS__-x - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-x
-- Performing Test CXX_COMPILER_SUPPORTS__-x - Failed
-- Performing Test C_COMPILER_SUPPORTS__c++
-- Performing Test C_COMPILER_SUPPORTS__c++ - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__c++
-- Performing Test CXX_COMPILER_SUPPORTS__c++ - Failed
-- Performing Test C_COMPILER_SUPPORTS__-std=c++17
-- Performing Test C_COMPILER_SUPPORTS__-std=c++17 - Failed
-- Performing Test CXX_COMPILER_SUPPORTS__-std=c++17
-- Performing Test CXX_COMPILER_SUPPORTS__-std=c++17 - Success
-- Performing Test C_COMPILER_SUPPORTS__-fno-exceptions
-- Performing Test C_COMPILER_SUPPORTS__-fno-exceptions - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-fno-exceptions
-- Performing Test CXX_COMPILER_SUPPORTS__-fno-exceptions - Success
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-but-set-variable
-- Performing Test C_COMPILER_SUPPORTS__-Wno-unused-but-set-variable - Success
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-but-set-variable
-- Performing Test CXX_COMPILER_SUPPORTS__-Wno-unused-but-set-variable - Success
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- TCL library: /usr/lib/x86_64-linux-gnu/libtcl.so
-- TCL header: /usr/include/tcl/tcl.h
-- TCL readline library: /usr/lib/x86_64-linux-gnu/libtclreadline.so
-- TCL readline header: /usr/include/x86_64-linux-gnu
-- Configuring incomplete, errors occurred!
To Reproduce
read_lef sample_tech.lef read_lef cell.lef read_def sample_def.def
If you replace the DATABASE MICRONS to 2000, the software will not crash and it will read the DEF file correctly.
With DATABASE MICRONS 1000, if you change coordinates of the rectangle such that the dimensions of both axes are not divisible by 10, the software will crash:
- ( 4750 1145 ) ( 4785 1480 )
- ( 4755 1140 ) ( 4780 1485 )
Relevant log output
Screenshots
No response
Additional Context
The problem is that the wire width is odd which is not allowed in odb (we should error rather than crash but that is another issue). Switch to 2000 makes the width double to an even value. Did you intend to have an odd width?
Thanks for making a nice small test case!
Thanks for the explanation! I did not know it is not allowed. Currently, I intend to have odd widths (for consistency/accuracy), but it won't be a huge problem if I round things up to make even widths.