Commit Graph

5164 Commits

Author SHA1 Message Date
Jeroen van Rijn
e6475fec4d Merge pull request #4449 from 0dminnimda/add-pie
Link as PIE for PIC by default
2024-11-04 14:25:31 +01:00
gingerBill
a0b35f67f8 Fix previous commit for arrays 2024-11-04 12:51:54 +00:00
0dminnimda
5e308cef5e Revert further simplifiction 2024-11-04 15:50:43 +03:00
gingerBill
bbf76fa43e Fix bug for foo().bar where foo() is a 0-value expression 2024-11-04 12:49:43 +00:00
0dminnimda
8ad5e46ff8 Simplify further 2024-11-04 15:44:07 +03:00
0dminnimda
c26e7e17a1 Simplify use of pie 2024-11-04 15:39:51 +03:00
gingerBill
31ea10490f Fix auto_cast matrix bug 2024-11-04 12:35:17 +00:00
0dminnimda
35f1b0f11e Add support for linking as pie 2024-11-04 02:35:49 +03:00
peachey2k2
04b000370b Add "-build-mode:dynamic" to the "odin help build" output 2024-11-01 15:51:18 +03:00
gingerBill
8a00d85cea Merge branch 'master' of https://github.com/odin-lang/Odin 2024-10-30 14:12:57 +00:00
gingerBill
2392300ffb Add warning for unsigned >= 0 like conditions in a for loop 2024-10-30 14:12:49 +00:00
gingerBill
f469bbb004 Merge pull request #4425 from bobsayshilol/misc-fixes
Misc fixes
2024-10-30 12:24:23 +00:00
gingerBill
ee76acd665 Merge pull request #4427 from laytan/posix-additions
Finish sys/posix with Linux and partial Windows support & clean up other packages as a result
2024-10-30 11:43:47 +00:00
Jeroen van Rijn
b46b34228e match_exact_value: return when type is compound
fixes #4431
2024-10-29 13:59:11 +01:00
Laytan
e064f8c6be fix #load_directory including nested directories 2024-10-28 18:59:39 +01:00
bobsayshilol
b59647084b 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-10-27 22:02:34 +00:00
bobsayshilol
bb308b3ff4 Add missing guards around push/pop pragmas
This matches all the other places where we silence Windows warnings.
2024-10-27 22:02:34 +00:00
bobsayshilol
c1496ab6c0 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-10-27 22:02:34 +00:00
bobsayshilol
4f800a7fda 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-10-27 22:02:34 +00:00
bobsayshilol
e67692b066 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-10-27 22:02:34 +00:00
bobsayshilol
771d308d64 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-10-27 21:24:36 +00:00
gingerBill
1f187adff4 Merge pull request #4416 from Yawning/fix/4413
src/big_int.cpp: Use square-multiply for exponentiation
2024-10-27 12:13:40 +00:00
gingerBill
f32e27d2e4 Fix bug caused due to incorrect type checking looking for context not defined in a context 2024-10-27 11:10:55 +00:00
Laytan Laats
69d375705e fix the typeid type kind of a typeid being set to Typeid_Invalid 2024-10-27 01:11:44 +02:00
gingerBill
4bde87de8f Merge pull request #4418 from laytan/check-packed-on-all-loads
check packed load and set alignment on all loads, not just lb_emit_load
2024-10-25 14:35:32 +01:00
Laytan Laats
bcf2b93c6e quote the dsymutil argument
Fixes #4417
2024-10-25 15:34:59 +02:00
Laytan Laats
da1e09c95d check packed load and set alignment on all loads, not just lb_emit_load 2024-10-25 15:23:15 +02:00
Yawning Angel
61795232f4 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-10-25 11:46:47 +09:00
gingerBill
33cc671302 Merge pull request #4403 from tf2spi/issue-4390-fix
Fix #4390 by assigning invalid entity type
2024-10-23 15:25:06 +01:00
gingerBill
c5ae7daecd Merge pull request #4404 from tf2spi/issue-4395-fix
Fixes #4395 by not assuming simd returns val
2024-10-23 15:24:59 +01:00
gingerBill
70bff68f69 Merge pull request #4408 from Lperlind/cache
cached.cpp: Improve internal cached robustness
2024-10-23 15:15:58 +01:00
laytan
50597e8691 fix erronous updating alignment of external global 2024-10-22 17:34:49 +02:00
Lucas Perlind
28b26043fb cached.cpp: Improve internal cached robustness
Do not memory map files; Windows cannot write to a file that is memory
mapped.
Write cache after llvm building. This ensures the cache won't have a
false positive if llvm fails.
2024-10-22 18:05:01 +11:00
Misomosi
6ef915c312 Fixes #4395 by not assuming simd returns val 2024-10-20 22:51:39 -04:00
Misomosi
01c7380df8 Fix #4390 by assigning invalid entity type 2024-10-20 22:45:30 -04:00
Laytan Laats
7989d512a0 add macos 15.0.1 to odin report and core/sys/info 2024-10-14 16:19:03 +02:00
gingerBill
417e9bb37f Fix #4373 2024-10-13 22:26:04 +01:00
gingerBill
b839d06ac8 Merge branch 'master' of https://github.com/odin-lang/Odin 2024-10-08 11:58:28 +01:00
gingerBill
131e8d4187 Disable exe path test 2024-10-08 11:57:54 +01:00
gingerBill
9fe8095a84 Merge pull request #4338 from laytan/fix-ternary-swallow-error
fix not erroring on invalid ternary
2024-10-04 12:25:54 +01:00
gingerBill
c305c9dd04 [ABI FIX] Fix 128-bit ABI issues 2024-10-04 11:16:33 +01:00
Laytan Laats
5d4fd09ff0 fix quaternion64 arith
Fixes #4282
2024-10-02 23:28:09 +02:00
gingerBill
53bb6c85f7 a ordered to an ordered 2024-10-02 15:48:58 +01:00
gingerBill
21d0b073b1 Sort flags on odin build -help - #4329 2024-10-02 15:43:13 +01:00
gingerBill
3498d4341d Fix #4330 2024-10-02 15:07:22 +01:00
gingerBill
aeb568f79a Ignore package runtime with using -vet-unused-packages 2024-10-02 15:04:50 +01:00
Laytan Laats
3ff887c6b6 fix not erroring on invalid ternary
For example: `a: f32 = true ? 1 : len` would get to the back-end without
errors.

Fixes #1690
2024-10-02 15:55:46 +02:00
olimpiu
5d57fe77be Fixed confusing (and incorrect) warning
Verbose errors *is* the new default
2024-09-30 20:46:03 -04:00
gingerBill
91dece1656 Change struct alignment rules for #max_field_align 2024-09-30 15:35:47 +01:00
gingerBill
a7d7c92a53 #min_field_align & #max_field_align; deprecate #field_align in favour of #min_field_align 2024-09-30 13:05:28 +01:00