Commit Graph

18845 Commits

Author SHA1 Message Date
korvahkh
feb008ab6e Add tests for constant unions 2026-08-19 20:16:51 -05:00
korvahkh
f97274fd0a Fix #7135
We have to handle unpacked structs in
llvm_const_named_struct
2026-08-19 20:13:00 -05:00
korvahkh
92ec71fa75 Prevent underflow of union padding 2026-08-19 20:13:00 -05:00
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
Jeroen van Rijn
97b5078ad5 Merge pull request #7395 from kalsprite/diagnostic_format_checking
diagnostics: let compiler check error() fmt strings + fixes
2026-08-20 01:14:41 +02: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
40a64a9dbb move test to build specific 2026-08-19 14:39:12 -07: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
Jeroen van Rijn
bd1a2dc7f0 Merge pull request #7390 from kalsprite/selfref_bitfield_hang
a self-referential bit_field hangs the compiler
2026-08-19 22:55:34 +02: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
Jeroen van Rijn
43d44e5942 Merge pull request #7388 from kalsprite/thread_pool_shutdown_wakeup
thread_pool: an exiting worker must not leave  published
2026-08-19 21:25:47 +02: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
4df8adb017 Merge pull request #7384 from odin-lang/bill/x86-merge-tables
rexcode/x86 merge tables
2026-08-19 18:01:52 +02:00
gingerBill
ea04ce30e4 Remove dead comment 2026-08-19 16:45:23 +01:00
gingerBill
22bdf11436 Rename to instruction_table.odin 2026-08-19 16:44:42 +01:00
gingerBill
bda4c2cd95 Merge ENCODING_TABLE and CLOBBER_TABLE into a single INSTRUCTION_TABLE 2026-08-19 16:44:19 +01:00
Jeroen van Rijn
057163d1d8 Merge pull request #7383 from karl-zylinski/handle-map-fixes
Handle Map: Nicer organization + fix broken test + add test
2026-08-19 17:39:50 +02:00
Karl Zylinski
4d7edd08d1 Fix broken example in handle_map/doc.odin 2026-08-19 17:13:38 +02:00
Karl Zylinski
36ae65bba2 Fix broken example in handle_map/doc.odin 2026-08-19 17:13:07 +02:00
gingerBill
7a01de6a45 Add extra tables to cpp-gen.odin 2026-08-19 16:08:02 +01:00
Karl Zylinski
a0a75bf4a7 Split the non-specific parts of the Handle Map out to a general.odin file. This means that the Handles and the generic procedure groups are no longer in static_handle_map.odin. Also enabled and fixed the static handle map test. Added another test that uses the generic procedure groups. 2026-08-19 17:03:59 +02: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