lowRISC / lowRISC/opentitan

[clang] Compiler bug when compiling a ujson_derive file

Open
#27,912 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SystemVerilog
Stars
3.6k
Forks
1.1k
Avg merge
2d 22h
Merged PRs (30d)
141

Description

Description

While working on https://github.com/lowRISC/opentitan/pull/27887, I identified what looks like a compiler bug in the clang that we used for the RISCV-32 toolchain. To reproduce, apply the following diff:

diff --git i/sw/device/tests/penetrationtests/json/cryptolib_fi_asym_commands.h w/sw/device/tests/penetrationtests/json/cryptolib_fi_asym_commands.h
index 303a338c12..46c7d6e43e 100644
--- i/sw/device/tests/penetrationtests/json/cryptolib_fi_asym_commands.h
+++ w/sw/device/tests/penetrationtests/json/cryptolib_fi_asym_commands.h
@@ -9,7 +9,7 @@
 extern "C" {
 #endif

+#define MODULE_ID MAKE_MODULE_ID('j', 'f', 'a')

 #define RSA_CMD_MAX_MESSAGE_BYTES 512
 #define RSA_CMD_MAX_N_BYTES 512

and run

 ./bazelisk.sh build --define bitstream=skip //sw/device/tests/penetrationtests/json:cryptolib_fi_asym_commands  --define DISABLE_VERILATOR_BUILD=true --config=riscv32

Compilation does not ever finish but the compiler quickly uses gigabytes of memory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Apply the diff to sw/device/tests/penetrationtests/json/cryptolib_fi_asym_commands.h, then run the provided bazelisk.sh build command with the riscv32 configuration. Start by reproducing the non-terminating compilation and excessive memory use; done means the compiler behavior is understood and the build no longer exhibits that failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.