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

be/c: fix code being generated for effect detected not to be used #3366

Conversation

michaellilltokiwa
Copy link
Member

@michaellilltokiwa michaellilltokiwa commented Jul 11, 2024

some code like if(effectenv->fzEnvInstalled<effNum>) was generated despite effect with effNum never being used.
This is due to effect.type.is_installed being used but not replace/default/abort etc.
The c compiler then complained about this:

/tmp/fuzion_test_process_13769855200547668566.c:134351:41: error: no member named 'fzEnvInstalled_28359' in 'struct fzThrd_effectsEnvironment'
        if (!fzThrd_effectsEnvironment->fzEnvInstalled_28359)
             ~~~~~~~~~~~~~~~~~~~~~~~~~  ^
/tmp/fuzion_test_process_13769855200547668566.c:142548:34: error: no member named 'fzEnvInstalled_27995' in 'struct fzThrd_effectsEnvironment'; did you mean 'fzEnvInstalled_27977'?
  if (fzThrd_effectsEnvironment->fzEnvInstalled_27995)
                                 ^~~~~~~~~~~~~~~~~~~~
                                 fzEnvInstalled_27977
/tmp/fuzion_test_process_13769855200547668566.c:81219:8: note: 'fzEnvInstalled_27977' declared here
  bool fzEnvInstalled_27977;
       ^
/tmp/fuzion_test_process_13769855200547668566.c:142971:37: error: no member named 'fzEnvInstalled_27995' in 'struct fzThrd_effectsEnvironment'; did you mean 'fzEnvInstalled_27977'?
    if (!fzThrd_effectsEnvironment->fzEnvInstalled_27995)
                                    ^~~~~~~~~~~~~~~~~~~~
                                    fzEnvInstalled_27977
/tmp/fuzion_test_process_13769855200547668566.c:81219:8: note: 'fzEnvInstalled_27977' declared here
  bool fzEnvInstalled_27977;
       ^
3 errors generated.

error 1: C backend: C compiler failed
C compiler call 'clang --target=x86_64-pc-linux-gnu -ftrapv -Wall -Werror -Wextra -Wpedantic -Wformat=2 -Wno-unused-parameter -Wshadow -Wwrite-strings -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs -Wno-strict-prototypes -Wno-gnu-empty-initializer -Wno-zero-length-array -Wno-trigraphs -Wno-gnu-empty-struct -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-pointer-to-int-cast -Wno-infinite-recursion -Wno-unused-but-set-variable -O3 -lgc -DGC_THREADS -DGC_PTHREADS -DPTW32_STATIC_LIB -DGC_WIN32_PTHREADS -fno-trigraphs -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -std=c11 -o test_process /home/not_synced/fuzion/build/include/shared.c /home/not_synced/fuzion/build/include/posix.c /tmp/fuzion_test_process_13769855200547668566.c' failed with exit code '1'

one error.

some code like `if(effectenv->fzEnvInstalled<effNum>)` was generated despite effect with effNum never being used. The c compiler then complained about this:
```
/tmp/fuzion_test_process_13769855200547668566.c:134351:41: error: no member named 'fzEnvInstalled_28359' in 'struct fzThrd_effectsEnvironment'
        if (!fzThrd_effectsEnvironment->fzEnvInstalled_28359)
             ~~~~~~~~~~~~~~~~~~~~~~~~~  ^
/tmp/fuzion_test_process_13769855200547668566.c:142548:34: error: no member named 'fzEnvInstalled_27995' in 'struct fzThrd_effectsEnvironment'; did you mean 'fzEnvInstalled_27977'?
  if (fzThrd_effectsEnvironment->fzEnvInstalled_27995)
                                 ^~~~~~~~~~~~~~~~~~~~
                                 fzEnvInstalled_27977
/tmp/fuzion_test_process_13769855200547668566.c:81219:8: note: 'fzEnvInstalled_27977' declared here
  bool fzEnvInstalled_27977;
       ^
/tmp/fuzion_test_process_13769855200547668566.c:142971:37: error: no member named 'fzEnvInstalled_27995' in 'struct fzThrd_effectsEnvironment'; did you mean 'fzEnvInstalled_27977'?
    if (!fzThrd_effectsEnvironment->fzEnvInstalled_27995)
                                    ^~~~~~~~~~~~~~~~~~~~
                                    fzEnvInstalled_27977
/tmp/fuzion_test_process_13769855200547668566.c:81219:8: note: 'fzEnvInstalled_27977' declared here
  bool fzEnvInstalled_27977;
       ^
3 errors generated.

error 1: C backend: C compiler failed
C compiler call 'clang --target=x86_64-pc-linux-gnu -ftrapv -Wall -Werror -Wextra -Wpedantic -Wformat=2 -Wno-unused-parameter -Wshadow -Wwrite-strings -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs -Wno-strict-prototypes -Wno-gnu-empty-initializer -Wno-zero-length-array -Wno-trigraphs -Wno-gnu-empty-struct -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-pointer-to-int-cast -Wno-infinite-recursion -Wno-unused-but-set-variable -O3 -lgc -DGC_THREADS -DGC_PTHREADS -DPTW32_STATIC_LIB -DGC_WIN32_PTHREADS -fno-trigraphs -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -std=c11 -o test_process /home/not_synced/fuzion/build/include/shared.c /home/not_synced/fuzion/build/include/posix.c /tmp/fuzion_test_process_13769855200547668566.c' failed with exit code '1'

one error.
```
@michaellilltokiwa michaellilltokiwa marked this pull request as draft July 11, 2024 14:15
@michaellilltokiwa michaellilltokiwa marked this pull request as ready for review July 12, 2024 09:08
Copy link
Collaborator

@maxteufel maxteufel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this to close #559 or do you consider there to be more to that issue?

@maxteufel maxteufel merged commit 83ec832 into tokiwa-software:main Jul 15, 2024
4 checks passed
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.

None yet

2 participants