Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: infinite recursion detected in function runcmd #125

Closed
chinggg opened this issue Jun 1, 2022 · 3 comments · Fixed by #126
Closed

error: infinite recursion detected in function runcmd #125

chinggg opened this issue Jun 1, 2022 · 3 comments · Fixed by #126

Comments

@chinggg
Copy link

chinggg commented Jun 1, 2022

I find this error when make qemu using GCC 11, though it can be solved by removing -Werror in CFLAGS.

riscv64-linux-gnu-gcc -Wall -Werror -O -fno-omit-frame-pointer -ggdb -MD -mcmodel=medany -ffreestanding -fno-common -nostdlib -mno-relax -I. -fno-stack-protector -fno-pie -no-pie   -c -o user/sh.o user/sh.c
user/sh.c: In function 'runcmd':
user/sh.c:58:1: error: infinite recursion detected [-Werror=infinite-recursion]
   58 | runcmd(struct cmd *cmd)
      | ^~~~~~
user/sh.c:89:5: note: recursive call
   89 |     runcmd(rcmd->cmd);
      |     ^~~~~~~~~~~~~~~~~
user/sh.c:109:7: note: recursive call
  109 |       runcmd(pcmd->left);
      |       ^~~~~~~~~~~~~~~~~~
user/sh.c:116:7: note: recursive call
  116 |       runcmd(pcmd->right);
      |       ^~~~~~~~~~~~~~~~~~~
user/sh.c:95:7: note: recursive call
   95 |       runcmd(lcmd->left);
      |       ^~~~~~~~~~~~~~~~~~
user/sh.c:97:5: note: recursive call
   97 |     runcmd(lcmd->right);
      |     ^~~~~~~~~~~~~~~~~~~
user/sh.c:127:7: note: recursive call
  127 |       runcmd(bcmd->cmd);
      |       ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: user/sh.o] Error 1
sora-blue added a commit to sora-blue/xv6-riscv that referenced this issue Jul 27, 2022
According to [issue mit-pdos#125 ](mit-pdos#125),
 the problem was found in GCC 11, so switch to GCC 11
@zhuiYeah
Copy link

怎么切换到gcc11

@Earthaa
Copy link

Earthaa commented Jun 7, 2023

According to my expeience, you can solve this by adding __attribute__((noreturn)) before line 56 in usr/sh.c file

@praneshp1org
Copy link

praneshp1org commented Jul 7, 2023

this can be solved by adding __attribute__((noreturn)) just above line 56 in sh.c the infinite recursion is then resolved

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 a pull request may close this issue.

4 participants