diff --git a/lib/std/crypto/dh.c3 b/lib/std/crypto/dh.c3 new file mode 100644 index 000000000..6d7649e98 --- /dev/null +++ b/lib/std/crypto/dh.c3 @@ -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); +} diff --git a/releasenotes.md b/releasenotes.md index 5ef9fa59e..3cceaba31 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -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. diff --git a/src/compiler/linker.c b/src/compiler/linker.c index 78aef9a6b..62200640e 100644 --- a/src/compiler/linker.c +++ b/src/compiler/linker.c @@ -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);