Commit Graph
5182 Commits
Author SHA1 Message Date
Laytan Laatsandflysand7 5a201d588b add macos 15.1.1 to odin report and sys/info 2024-12-01 11:54:56 +11:00
gingerBillandflysand7 1be9833073 Convert mutex guard to "try lock" 2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 0e3572947a Fix #4508 for abs, min, max (#4516)
* Fix #4508 for abs, min, max and the rest of the builtins.

None of these segfault now:
```odin
package bug

main :: proc() {
	p :: proc() {}

	// _ = len(p())
	// _ = cap(p())

	// _ = size_of(p())
	// _ = align_of(p())

	// T :: struct {}
	// _ = offset_of(p())
	// _ = offset_of(T, p())
	// _ = offset_of(p(), foo)
	// _ = offset_of(p(), "")

	// _ = type_of(p())
	// _ = type_info_of(p())
	// _ = typeid_of(p())

	// A: [4]int
	// _ = swizzle(p())    //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---
	// _ = swizzle(A, p()) //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---

	// _ = complex(p(), p())
	// _ = quaternion(p(), p(), p(), p())
	// _ = quaternion(w=p(), x=p(), y=p(), z=p())

	// _ = real(p())
	// _ = imag(p())
	// _ = jmag(p())
	// _ = kmag(p())
	// _ = conj(p())

	// _ = expand_values(p())

	// _ = min(p())
	// _ = max(p())
	// _ = abs(p())
	// _ = clamp(p(), p(), p())

	// _ = soa_zip(p())
	// _ = soa_unzip(p())
}
```
2024-12-01 11:54:56 +11:00
gingerBillandflysand7 3c3c59fc03 Allow for odin help build etc 2024-12-01 11:54:56 +11:00
Laytan Laatsandflysand7 1d8eb3aac4 checker: only error with -vet-cast when it is actually castable 2024-12-01 11:54:54 +11:00
gingerBillandflysand7 514b537dd5 Improve odin help -foo usage 2024-12-01 11:54:54 +11:00
jakubtomsuandflysand7 aaea7b27f2 report error when builtin min/max has 1 (non-type) param 2024-12-01 11:54:54 +11:00
Laytan Laatsandflysand7 468c0b573a add missing macos version 2024-12-01 11:54:54 +11:00
gingerBillandflysand7 57e0c41982 Make lowercase 2024-12-01 11:54:54 +11:00
gingerBillandflysand7 d613a9ee5a Fix typo 2024-12-01 11:54:54 +11:00
gingerBillandflysand7 e58ac3cb8d Add -linker:<string> to replace -lld and -radlink 2024-12-01 11:54:54 +11:00
gingerBillandflysand7 95731aceac Disallow -lld and -radlink to be used together 2024-12-01 11:54:54 +11:00
gingerBillandflysand7 ec96939953 Add -radlink 2024-12-01 11:54:53 +11:00
gingerBillandflysand7 e72736a5a8 Remove #relative types from the compiler 2024-12-01 11:54:53 +11:00
gingerBillandflysand7 31c630dfea Make #relative types an error in parsing 2024-12-01 11:54:53 +11:00
gingerBillandflysand7 95c812db78 Keep ASAN happy on type assertions 2024-12-01 11:54:53 +11:00
bayo-codeandflysand7 7bd49cf018 Added support for odin build -target:? 2024-12-01 11:54:53 +11:00
bayo-codeandflysand7 9fbde3c1b8 Revert "List the supported targets using odin targets"
This reverts commit b589e3c499.
2024-12-01 11:54:53 +11:00
bayo-codeandflysand7 c73c438db9 List the supported targets using odin targets 2024-12-01 11:54:53 +11:00
gingerBillandflysand7 ddca55165d Remove duplicates in -defineables 2024-12-01 11:54:53 +11:00
Jeroen van Rijnandflysand7 826abd6245 && 2024-12-01 11:54:53 +11:00
Jeroen van Rijnandflysand7 d44f8c377a Phrasing! 2024-12-01 11:54:53 +11:00
Jeroen van Rijnandflysand7 9ecc378803 Suggest -microarch:native if popcnt instruction is missing.
Fixes #4453.
2024-12-01 11:54:53 +11:00
Morten Hauke Solvangandflysand7 6c750c6670 Suggestion when assigning enum to bit_set 2024-12-01 11:54:53 +11:00
Dominik Pötzschkeandflysand7 a71832570c added braces 2024-12-01 11:54:53 +11:00
Dominik Pötzschkeandflysand7 f37ec05548 adjust memory allocation 2024-12-01 11:54:52 +11:00
Dominik Pötzschkeandflysand7 841996435b fix: fix windows params bug 2024-12-01 11:54:52 +11:00
0dminnimdaandflysand7 24ec0f0ebf Revert further simplifiction 2024-12-01 11:54:52 +11:00
0dminnimdaandflysand7 a7f32109e8 Simplify further 2024-12-01 11:54:52 +11:00
0dminnimdaandflysand7 4f37b34654 Simplify use of pie 2024-12-01 11:54:52 +11:00
0dminnimdaandflysand7 480f32586e Add support for linking as pie 2024-12-01 11:54:52 +11:00
gingerBillandflysand7 619b382635 Fix previous commit for arrays 2024-12-01 11:54:52 +11:00
gingerBillandflysand7 50e46326a6 Fix bug for foo().bar where foo() is a 0-value expression 2024-12-01 11:54:52 +11:00
gingerBillandflysand7 fafac1bc77 Fix auto_cast matrix bug 2024-12-01 11:54:52 +11:00
peachey2k2andflysand7 186499c8af Add "-build-mode:dynamic" to the "odin help build" output 2024-12-01 11:54:52 +11:00
bobsayshilolandflysand7 96e6393614 Plug a memory leak
The call to |array_make()| always allocates and since this variable was
unused it lead to a leak. Simply plug it by removing it.
2024-12-01 11:54:52 +11:00
bobsayshilolandflysand7 73b6461710 Add missing guards around push/pop pragmas
This matches all the other places where we silence Windows warnings.
2024-12-01 11:54:52 +11:00
bobsayshilolandflysand7 56094f3580 Fix passing nullptr to args marked as non-null
libstdc++'s |memcpy| and |memset| both state that their inputs should
never be a nullptr since this matches the C spec. Some compilers act on
these hints, so we shouldn't unconditionally call these as it would
signal to the compiler that they can't be nullptrs.

As an example, the following code will always call |do_something()|
when compiled with optimisations since GCC version 4.9:
```
    void clear(void *ptr, int size) {
        memset(ptr, 0, size);
    }
    void example(void *ptr, int size) {
        clear(ptr, size);
        if (ptr != nullptr) do_something();
    }
```
2024-12-01 11:54:52 +11:00
bobsayshilolandflysand7 30fb2ed59d Avoid undefined arithmetic shifting
The result of a left shift on a positive signed integer (Rune) must fit
into an unsigned integer otherwise it's undefined behaviour, as is left
shifting a negative integer by any amount. This code can only be hit if
|x >= 0xf0| and hence a left shift of 31 will always be undefined
unless the input is 0 or 1.

To avoid hitting this we can instead extend the lowest bit to be the
mask if we assume that ints are 2's complement, which we already do
elsewhere. This generates identical code in testing on Compiler
Explorer and the Odin test suite passes locally with this change.

Note that the original code would change to be defined behaviour in
C++20, however we are currently build with |-std=c++14| in the build
scripts.
2024-12-01 11:54:51 +11:00
bobsayshilolandflysand7 ddde456af7 Avoid member access through nullptr in debug
If |result_count| is 0 then |results| will be a nullptr and hence the
access |results->Tuple| is undefined behaviour. There's already an
early return in the 0 branch so move that to be the first thing so that
we can guarantee that it's not a nullptr.

Note that technically we take the address of the result so it's not
actually dereferencing it, however UBSan doesn't care about that.
2024-12-01 11:54:51 +11:00
bobsayshilolandflysand7 b10538da7a Fix invalid union access
UBSan spotted that |src->Basic.kind| had a value outside the range of
|BasicKind| due to it actually being a |Type_Pointer|. Since these are
stored in a union there could be cases where the value of |kind| just
so happens to be |Basic_string|, in which case the branch would have
been taken when it shouldn't have been.

To fix this simply check that it's a |Type_Basic| before treating it as
a |Basic|.
2024-12-01 11:54:51 +11:00
Laytanandflysand7 7de56ec852 fix #load_directory including nested directories 2024-12-01 11:54:51 +11:00
Jeroen van Rijnandflysand7 c9c237babf match_exact_value: return when type is compound
fixes #4431
2024-12-01 11:54:51 +11:00
Yawning Angelandflysand7 111f10cbbf src/big_int.cpp: Use square-multiply for exponentiation
For utterly unrealistic constant sizes, this still crashes on my system,
but it crashes fast due to the OOM killer, and people using rediculously
large exponents get what they deserve.
2024-12-01 11:54:51 +11:00
gingerBillandflysand7 197339d91d Add warning for unsigned >= 0 like conditions in a for loop 2024-12-01 11:54:51 +11:00
gingerBillandflysand7 63f880ae80 Fix bug caused due to incorrect type checking looking for context not defined in a context 2024-12-01 11:54:51 +11:00
Laytan Laatsandflysand7 8e6cbe9a29 fix the typeid type kind of a typeid being set to Typeid_Invalid 2024-12-01 11:54:51 +11:00
Laytan Laatsandflysand7 6e534c0e24 check packed load and set alignment on all loads, not just lb_emit_load 2024-12-01 11:54:50 +11:00
Laytan Laatsandflysand7 64fdf6e18f quote the dsymutil argument
Fixes #4417
2024-12-01 11:54:50 +11:00
Misomosiandflysand7 f1667422e6 Fix #4390 by assigning invalid entity type 2024-12-01 11:54:50 +11:00