Skip to content

Commit

Permalink
Compiler crash when compiling c code in a library without --obj-out #…
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Oct 2, 2024
1 parent 131a783 commit 1b8f8c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/std/crypto/dh.c3
Original file line number Diff line number Diff line change
@@ -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);
}
1 change: 1 addition & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/linker.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1b8f8c5

Please sign in to comment.