odb: Bazel build fails on linux/aarch64 — char fc compared to EOF in def/lef lexers
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 80/100
Research direction
Start with the comment-skipping loops near line 531 of src/odb/src/def/def/def_keywords.cpp and line 691 of src/odb/src/lef/lef/lef_keywords.cpp, where fc is declared as char but holds the int result of GETC() or lefGetc(). Change the declaration to int in both files, leaving the other comparisons as they are. Done when the two -Wtautological-constant-out-of-range-compare errors no longer occur in the Bazel build on linux/aarch64.
Written by the indexing model from the issue text.
Description
Summary
The Bazel build of //:openroad fails on linux/aarch64 at master f3d27840b65a. Two translation units fail with the same error, and with --keep_going they are the only two failures in the build:
src/odb/src/def/def/def_keywords.cpp:567:16: error: result of comparison of constant -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
src/odb/src/lef/lef/lef_keywords.cpp:729:16: error: result of comparison of constant -1 with expression of type 'char' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
Cause
In both lexers the comment-skipping loop stores the result of GETC() / lefGetc() in char fc (def_keywords.cpp:531, lef_keywords.cpp:691) and then tests fc == EOF. Both functions return int and return EOF (-1) at end of input.
- On aarch64 Linux
charis unsigned, soEOFis stored as 255 and the test can never be true. The warning is correct, and-Werrormakes it a build failure. - x86_64 and Apple arm64 both use signed
char, so CI on those platforms does not see this.
Runtime effect (from reading the code, not observed)
- aarch64: if a
#comment is the last line of a DEF/LEF file with no trailing newline,GETC()keeps returningEOF.fcnever equalsEOFor'\n', so the loop never exits. - x86_64: a 0xFF byte inside a comment compares equal to
EOF, so the lexer returns early.
Suggested fix
Declare fc as int in both functions, matching the return type of GETC() / lefGetc(). The other comparisons in those blocks (settings->CommentChar, '&', magic[...], '\n') work unchanged with an int. The neighbouring EOF checks in the same files (ch, c, cc) already use int and are not flagged.
Reproduce
On a native linux/arm64 host (we used a GitHub-hosted ubuntu-24.04-arm runner, ubuntu:24.04 container, bazelisk 1.27.0):
bazelisk build --config=release --//:platform=cli --keep_going //:openroad
The hermetic toolchain is llvm-toolchain-minimal-linux-arm64. The same command at the same commit builds cleanly on x86_64.
Happy to send a PR if that's useful.
- Dominant language
- Verilog
- Stars
- 3.2k
- Forks
- 1.1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 270
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from The-OpenROAD-Project/OpenROAD
-
OpenRCX: extMeasure::calcRes0 segfaults on a null getRes() result when a rules file has sparse per-layer tablesPossibly taken @AcKoucher claimed this today. Openbug rcx
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
The-OpenROAD-Project/OpenROAD#12052 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
syn: acd_resynth -apply segfaults on a database resynthesized in an earlier processPossibly taken @zzf2024 claimed this 2 days ago. Openbug syn
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
The-OpenROAD-Project/OpenROAD#12046 · 2 comments ·
Maintainers usually reply within 1 day
-
check_placement: padding check flags a legal cell above a fixed block whose bottom is in the upper half of a rowPossibly taken @gudeh claimed this today. Openbug dpl
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
The-OpenROAD-Project/OpenROAD#12038 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
dft: ScanStitch::Stitch dereferences std::deque::end() on chains of 3+ cellsPossibly taken @mmporong claimed this 8 days ago. Opendft
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
The-OpenROAD-Project/OpenROAD#11985 · 1 comment ·
Maintainers usually reply within 1 day
-
[cts] -useful_skew: add a test to document and enforce the intent at block boundariesPossibly taken @precisionmoon claimed this 3 days ago. Opencts documentation question rsz
The-OpenROAD-Project/OpenROAD#12088 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in The-OpenROAD-Project/OpenROAD
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nopSolutions/nopCommerce#8439 ·
Maintainers usually reply within 1 day
-
bug:new
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
callstackincubator/simlock#1234 · 1 comment ·
Maintainers usually reply within 1 day
-
🐛 Bug: node-sqlite3 example fails on values that contain a quotePossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
mochajs/mocha-examples#130 ·
-
`HandleEmptyInListsPlugin` / `SafeNullComparisonPlugin` skip expressions nested in `eb.selectFrom(...)` subqueriesPossibly taken @superbot-helper claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
kysely-org/kysely#2216 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day