Skip to content

Commit

Permalink
Fix bug where analysing subexpr relied on them not being analysed. Fi…
Browse files Browse the repository at this point in the history
…x issue where converting a const initializer bool to integer failed. Fix of issue where the case check assumed other cases were const values. Remove PTHREAD for windows.
  • Loading branch information
lerno committed Jul 16, 2023
1 parent 0469012 commit 25d0e50
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 334 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ jobs:
../build/c3c compile-run examples/fannkuch-redux.c3
../build/c3c compile-run examples/contextfree/boolerr.c3
../build/c3c compile-run examples/load_world.c3
../build/c3c compile-run examples/load_world.c3
../build/c3c compile --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3
- name: Build testproject
run: |
cd resources/testproject
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:
../build/c3c compile-run examples/fannkuch-redux.c3
../build/c3c compile-run examples/contextfree/boolerr.c3
../build/c3c compile-run examples/load_world.c3
../build/c3c compile --test -g -O0 --threads 1 --target macos-x64 examples/constants.c3
- name: Build testproject
run: |
cd resources/testproject
Expand Down
13 changes: 3 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ else()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -gdwarf-3 -O3 -fno-exceptions")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-3 -fno-exceptions")
else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O1 -fsanitize=undefined -fno-exceptions")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1 -fsanitize=undefined -fno-exceptions")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-3 -O3 -fsanitize=undefined -fno-exceptions")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-3 -O1 -fsanitize=undefined -fno-exceptions")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -gdwarf-3 -O3 -fsanitize=undefined -fno-exceptions")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-3 -fsanitize=undefined -fno-exceptions")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-3 -O1 -fsanitize=undefined -fno-exceptions")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-exceptions")
endif()
endif()
Expand Down Expand Up @@ -270,7 +270,6 @@ add_executable(c3c
src/utils/malloc.c
src/utils/stringutils.c
src/utils/taskqueue.c
src/utils/stacktrace.c
src/utils/json.c
src/build/project.c
src/utils/vmem.c
Expand Down Expand Up @@ -347,9 +346,6 @@ endif()

if (WIN32)
target_link_libraries(c3c Winhttp.lib)
target_link_libraries(c3c imagehlp.lib)
elseif(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-pie")
endif()

if (CURL_FOUND)
Expand Down Expand Up @@ -386,9 +382,6 @@ else()
target_link_options(c3c PRIVATE -pthread)
target_compile_options(c3c PRIVATE -pthread -Wall -Werror -Wno-unknown-pragmas -Wno-unused-result
-Wno-unused-function -Wno-unused-variable -Wno-unused-parameter)
if (WIN32)
target_compile_definitions(c3c PRIVATE USE_PTHREAD=1)
endif()
endif()


Expand Down
2 changes: 1 addition & 1 deletion src/compiler/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static void free_arenas(void)
if (debug_stats) print_arena_status();
}

void compiler_print_bench(void)
static void compiler_print_bench(void)
{
if (debug_stats)
{
Expand Down
1 change: 1 addition & 0 deletions src/compiler/llvm_codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ static void gencontext_verify_ir(GenContext *context)
{
if (*error)
{
puts("IR integrity failure.");
LLVMDumpModule(context->module);
error_exit("Could not verify IR: %s", error);
}
Expand Down
1 change: 0 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ int main_real(int argc, const char *argv[])
"------------------------------------------------------------\n");
bench_begin();

install_stacktrace(argv[0]);
// Setjmp will allow us to add things like fuzzing with
// easy restarts.
int result = setjmp(on_error_jump);
Expand Down
1 change: 0 additions & 1 deletion src/utils/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@
#define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop))
#endif

void install_stacktrace(const char *program_name);
Loading

0 comments on commit 25d0e50

Please sign in to comment.