Commit Graph

6846 Commits

Author SHA1 Message Date
korvahkh
02246ac6fd Implement fixes for constant unions
Note that with this commit, casting through
multiply-nested unions is forbidden, e.g.
```
U :: union {int, V}
V :: union {bool}
x: U = true
```
does not compile.
(Previously the compiler would simply crash)

This is to avoid situations where adding variants
can lead to unexpected changes in the value.

For example if `U` is changed to have a `bool`
variant of its own:
```
U :: union {int, bool, V}
```
Then `x: U = true` would equal
`U(true)` instead of `U(V(true))`.

Single-variant unions are exempt, primarily to
improve the ergonomics of `Maybe` in cases like:
```
x: Maybe(union{int, bool}) = 1
```

Fix #6100
Fix #6699
Fix #6895
Fix #6896
Fix #6897
Fix #7036
Fix #7083
Fix #7091
2026-08-19 20:12:56 -05:00
Jeroen van Rijn
7f80c7093a Merge pull request #7396 from kalsprite/union_const_backend
peel union constant to its variant
2026-08-20 01:51:05 +02:00
kalsprite
cf5f181228 peel union constant to its variant 2026-08-19 16:30:37 -07:00
kalsprite
f84735af42 missed site 2026-08-19 15:50:55 -07:00
kalsprite
f17c86d936 diagnostics: let compiler check error() fmt strings + fixes 2026-08-19 15:39:39 -07:00
gingerBill
6defecf436 Merge pull request #7392 from kalsprite/asm_extend_mnemonics
amd64 asm: extend family emits mnemonic that doesnt exist
2026-08-19 23:54:37 +02:00
gingerBill
b2f47a1ba0 Merge pull request #7393 from kalsprite/asm_two_operand
asm: multi-instruction template computed with one operand twice
2026-08-19 23:53:54 +02:00
kalsprite
26ae28dfb7 asm: multi-instruction template computed with one operand twice 2026-08-19 14:32:03 -07:00
Jeroen van Rijn
8aa0ce7291 Merge pull request #7391 from kalsprite/codegen_worker_exit
codegen worker must not exit process with running siblings
2026-08-19 23:09:26 +02:00
kalsprite
b9983105bd amd64 asm: extend family emits mnemonic that doesnt exist 2026-08-19 14:03:56 -07:00
kalsprite
cd8fc51efc codegen worker must not exit process with running siblings 2026-08-19 13:44:32 -07:00
kalsprite
389416c3ef a self-referential hangs the compiler 2026-08-19 13:27:49 -07:00
kalsprite
239ced8731 thread_pool: an exiting worker must not leave published 2026-08-19 12:09:20 -07:00
Jeroen van Rijn
b7944229e5 Merge pull request #7385 from kalsprite/bit_field_value_range
bitfield: a constant is range-checked only while it is untyped
2026-08-19 20:48:58 +02:00
Jeroen van Rijn
2c3a7f4502 Merge pull request #7370 from kalsprite/base_prefix_digit_count
big_int: a base prefix with only digit separators has no digits
2026-08-19 20:43:00 +02:00
kalsprite
c580e1af93 big_int: base prefix iwth only seperateors and no digits 2026-08-19 11:29:28 -07:00
kalsprite
8c239a8f43 range check bitfield fields for untyped constants 2026-08-19 10:52:58 -07:00
gingerBill
7a6f70ba31 False positives: Ignore the out pinned parameters for the time being 2026-08-19 17:34:14 +01:00
gingerBill
2873e323c7 Fix #align_stack redundancy checks 2026-08-19 14:52:35 +01:00
gingerBill
5e165d2393 Add even more diagnostics for pinned registers; and begin work on redundant #align_stack checks 2026-08-19 14:50:08 +01:00
gingerBill
7638ac1bd4 Add more checks for flag clobbering 2026-08-19 14:09:46 +01:00
gingerBill
adbd1bd930 Add code (but disablled) to warn for redundant #clobber and #volatile 2026-08-19 13:56:15 +01:00
gingerBill
d4f81b5220 Add checks to see if diverging asm templates are actually diverging 2026-08-19 13:51:28 +01:00
gingerBill
229a5164a7 Add warning for unused lables in asm templates 2026-08-19 13:17:10 +01:00
gingerBill
5917d5db6e Add error message for immediate-operand specificity 2026-08-19 13:12:15 +01:00
gingerBill
0c42447192 Add pin class/width and tie class checks 2026-08-19 13:11:08 +01:00
gingerBill
75c91feb36 Check for output parameters not used but pinned; Check for templates with observable effects but not marked as #volatile 2026-08-19 12:56:03 +01:00
gingerBill
8956deb322 Check for implicitly read registers which have not be handled 2026-08-19 12:29:54 +01:00
gingerBill
6d903e9bde Remove implicit_rd from clobber 2026-08-19 11:56:07 +01:00
gingerBill
4cf22b3efa Merge pull request #7380 from dbriemann/dlb/vpdpwssd
Add AVX-512 VNNI VPDPWSSD support to inline assembly
2026-08-19 12:53:41 +02:00
Jeroen van Rijn
ba9011be8b Merge pull request #7381 from Kelimion/fix-7379
Let FreeBSD use default `gb_copy_file` path
2026-08-19 12:16:16 +02:00
gingerBill
8d0cc4d64b Clobber implicit_wr and implicit_rd 2026-08-19 11:03:50 +01:00
Jeroen van Rijn
910a64983d Remove duplicated size 2026-08-19 11:58:48 +02:00
gingerBill
ec81477af6 Merge branch 'master' of https://github.com/odin-lang/Odin 2026-08-19 10:42:52 +01:00
Jeroen van Rijn
f52df84ead Let FreeBSD use default gb_copy_file path
Also add some more error handling to the Linux path.

Fixes #7379
2026-08-19 10:34:18 +02:00
David Linus Briemann
6e1ae963a6 fix asm template generator lifetime 2026-08-19 09:46:10 +02:00
David Linus Briemann
36af738347 core:rexcode: regenerate x86 encoding tables 2026-08-19 09:09:58 +02:00
Jeroen van Rijn
ec4dd3c959 Fix #7377
Allow `(-a).x` and `(+a).x` on a Vec2

Fixes #7377
2026-08-19 00:39:55 +02:00
gingerBill
4648a78168 Fix #7376 2026-08-18 22:07:24 +01:00
gingerBill
9870cd4c36 Merge pull request #7271 from odin-lang/bill/inline-asm
`asm` templates
2026-08-18 19:19:40 +02:00
gingerBill
27d00c3c1c LLVM asm backend: %gs:disp() -> %gs:disp 2026-08-18 17:18:38 +01:00
gingerBill
d06c25cada Restrict usage of asm templates to be declarations or called directly 2026-08-18 15:01:49 +01:00
gingerBill
a86e523053 Allow for inlineable asm calls 2026-08-18 14:57:34 +01:00
gingerBill
fd9ccd7b10 Support segment overrides on asm memory operands 2026-08-18 14:44:24 +01:00
gingerBill
12c89ee2bf Allow for [base - disp] 2026-08-18 14:11:01 +01:00
gingerBill
6e17e7a2de Add missing x86 instructions 2026-08-18 13:19:23 +01:00
gingerBill
e0d8300399 Keep compiler happy 2026-08-18 11:58:49 +01:00
gingerBill
18df1ed23e Correct clobber_table.odin 2026-08-18 11:44:35 +01:00
gingerBill
80d7f6462a Minor clean up 2026-08-18 11:33:49 +01:00
gingerBill
8e807fb7aa Use new clobber forms in check_asm.cpp 2026-08-18 11:23:20 +01:00