justinethier / cyclone

:cyclone: A brand-new compiler that allows practical application development using R7RS Scheme. We provide modern features and a stable system capable of generating fast native binaries.
http://justinethier.github.io/cyclone/
MIT License
823 stars 42 forks source link

Compiler warnings generated for Cyc_st_add calls #466

Closed justinethier closed 3 years ago

justinethier commented 3 years ago

Observe many of the following warnings in the build logs for Github Actions / MacOS:

scheme/base.c:2340:3: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
  Cyc_st_add(data, "scheme/base.sld:lib-init:schemebase");
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/cyclone/runtime.h:727:21: note: expanded from macro 'Cyc_st_add'
  if ((void *)frame != (void *)thd->stack_prev_frame) { \
      ~~~~~~~~~~~~~ ^
justinethier commented 3 years ago

The intent here is to use a fast pointer comparison to avoid filling up the call history buffer when making tail calls.

We cannot use strcmp because it may incur a significant performance penalty.

justinethier commented 3 years ago

This is reproducible on Ubuntu 20.04 with clang 10.0.0-4.

justinethier commented 3 years ago

We could use -Wno-string-compare to suppress the warning, but it would be better if a code fix could be made.

justinethier commented 3 years ago

Verified the warnings are no longer generated on Ubuntu or MacOS. Closing.