Compiler crash when compiling c code in a library without --obj-out #1503.

This commit is contained in:
Christoffer Lerno
2024-10-03 00:56:01 +02:00
parent 131a783e89
commit 1b8f8c5f5a
3 changed files with 15 additions and 2 deletions

12
lib/std/crypto/dh.c3 Normal file
View File

@@ -0,0 +1,12 @@
module std::crypto::dh;
import std::math::bigint;
fn BigInt generate_secret(BigInt p, BigInt x, BigInt y)
{
return y.mod_pow(x, p);
}
fn BigInt public_key(BigInt p, BigInt g, BigInt x)
{
return g.mod_pow(x, p);
}

View File

@@ -71,6 +71,7 @@
- Detect recursion errors on non-recursive mutexes in safe mode.
- Foreach over distinct pointer failed to be caught as error #1506.
- Foreach over distinct iterable would ignore operator(len).
- Compiler crash when compiling c code in a library without --obj-out #1503.
### Stdlib changes
- Additional init functions for hashmap.

View File

@@ -872,8 +872,8 @@ const char *cc_compiler(const char *cc, const char *file, const char *flags, con
{
const char *dir = compiler.build.object_file_dir;
if (!dir) dir = compiler.build.build_dir;
if (output_subdir) dir = file_append_path(dir, output_subdir);
dir_make(dir);
if (output_subdir) dir = dir ? file_append_path(dir, output_subdir) : output_subdir;
if (dir) dir_make(dir);
bool is_cl_exe = str_eq(cc, "cl.exe");
char *filename = NULL;
bool split_worked = file_namesplit(file, &filename, NULL);