Skip to content

Conversation

@visitorckw
Copy link
Collaborator

When ARCH=riscv, the following compilation errors occur:

In file included from src/main.c:41:
src/codegen.c: In function ‘cfg_flatten’:
src/codegen.c:111:9: error: ‘flatten_ir’ undeclared (first use in this function); did you mean ‘fflatten_ir’?
111 | flatten_ir->src0 = fn->func->stack_size;
| ^~~~~~~~~~
| fflatten_ir
src/codegen.c:111:9: note: each undeclared identifier is reported only once for each function it appears in
src/codegen.c:110:19: warning: unused variable ‘fflatten_ir’ [-Wunused-variable]
110 | ph2_ir_t *fflatten_ir = add_ph2_ir(OP_define);
| ^~~~~~~~~~~

Fix the erroneous variable name 'fflatten_ir' to 'flatten_ir' to avoid compilation errors.

The reason this error wasn't discovered in the past is because the current CI doesn't actually test the ARCH=riscv scenario. The 'make clean' command does not delete config files. This led to an issue during testing with ARCH=riscv, where 'make' used the ARCH=arm config because the config file already existed. Consequently, ARCH=arm was tested twice while ARCH=riscv wasn't tested at all.

Fix the CI by changing 'make clean' to 'make distclean' to ensure that ARCH=riscv undergoes complete testing.

visitorckw added 2 commits May 7, 2024 13:24
When ARCH=riscv, the following compilation errors occur:

In file included from src/main.c:41:
src/codegen.c: In function ‘cfg_flatten’:
src/codegen.c:111:9: error: ‘flatten_ir’ undeclared (first use in this function); did you mean ‘fflatten_ir’?
  111 |         flatten_ir->src0 = fn->func->stack_size;
      |         ^~~~~~~~~~
      |         fflatten_ir
src/codegen.c:111:9: note: each undeclared identifier is reported only once for each function it appears in
src/codegen.c:110:19: warning: unused variable ‘fflatten_ir’ [-Wunused-variable]
  110 |         ph2_ir_t *fflatten_ir = add_ph2_ir(OP_define);
      |                   ^~~~~~~~~~~

Fix the erroneous variable name 'fflatten_ir' to 'flatten_ir' to avoid
compilation errors.

Fixes: 7f328f3 ("Apply editorial changes")
The 'make clean' command does not delete config files. This led to an
issue during testing with ARCH=riscv, where 'make' used the ARCH=arm
config because the config file already existed. Consequently, ARCH=arm
was tested twice while ARCH=riscv wasn't tested at all.

The fix involves changing 'make clean' to 'make distclean' to ensure
that ARCH=riscv undergoes complete testing.
@jserv jserv merged commit 1b34919 into sysprog21:master May 7, 2024
@jserv
Copy link
Collaborator

jserv commented May 7, 2024

Thank @visitorckw for contributing!

@visitorckw visitorckw deleted the fix-build-failure-riscv branch May 7, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants