aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
AgeCommit message (Collapse)Author
2024-03-30spirv: clz, ctz for openclRobin Voetter
This instruction seems common in compiler_rt.
2024-03-29Sema: allow .ptr on pointer to arrayVeikka Tuominen
2024-03-28add tests for fixed stage1 bugsVeikka Tuominen
Closes #10357 Closes #11236 Closes #11615 Closes #12055
2024-03-28allow `@errorcast` to cast error sets to error unionsHydroH
2024-03-26compiler: audit uses of `ptr.addr` in the frontendmlugg
This commit also performs some refactors to `TypedValue.print` in preparation for improved comptime pointer access logic. Once that logic exists, `TypedValue.print` can use Sema to access pointers for more helpful printing. This commit also implements proposal #19435, because the existing logic there relied on some blatantly incorrect code in `Value.sliceLen`. Resolves: #19435
2024-03-25behavior: skip newly failing testmlugg
This test has regressed due to a bug in the self-hosted COFF linker. Jakub recommended disabling it for now, since the COFF linker is being effectively rewritten, so there is little point in fixing the bug now.
2024-03-25compiler: implement analysis-local comptime-mutable memorymlugg
This commit changes how we represent comptime-mutable memory (`comptime var`) in the compiler in order to implement the intended behavior that references to such memory can only exist at comptime. It does *not* clean up the representation of mutable values, improve the representation of comptime-known pointers, or fix the many bugs in the comptime pointer access code. These will be future enhancements. Comptime memory lives for the duration of a single Sema, and is not permitted to escape that one analysis, either by becoming runtime-known or by becoming comptime-known to other analyses. These restrictions mean that we can represent comptime allocations not via Decl, but with state local to Sema - specifically, the new `Sema.comptime_allocs` field. All comptime-mutable allocations, as well as any comptime-known const allocs containing references to such memory, live in here. This allows for relatively fast checking of whether a value references any comptime-mtuable memory, since we need only traverse values up to pointers: pointers to Decls can never reference comptime-mutable memory, and pointers into `Sema.comptime_allocs` always do. This change exposed some faulty pointer access logic in `Value.zig`. I've fixed the important cases, but there are some TODOs I've put in which are definitely possible to hit with sufficiently esoteric code. I plan to resolve these by auditing all direct accesses to pointers (most of them ought to use Sema to perform the pointer access!), but for now this is sufficient for all realistic code and to get tests passing. This change eliminates `Zcu.tmp_hack_arena`, instead using the Sema arena for comptime memory mutations, which is possible since comptime memory is now local to the current Sema. This change should allow `Decl` to store only an `InternPool.Index` rather than a full-blown `ty: Type, val: Value`. This commit does not perform this refactor.
2024-03-21disable failing behavior test: "reinterpret extern union"Andrew Kelley
see tracking issue #19389
2024-03-21disable failing behavior test: "comptime bitcast with fields following f80"Andrew Kelley
see tracking issue #19387
2024-03-21disable failing behavior test: "bitcast packed union to integer"Andrew Kelley
see tracking issue #19384
2024-03-19Merge pull request #19337 from Snektron/spirv-globalsRobin Voetter
spirv: rework generic global
2024-03-18spirv: enable passing testsRobin Voetter
2024-03-18spirv: skip test that miscompiles on IntelRobin Voetter
2024-03-18spirv: unused instruction pruning linker passRobin Voetter
2024-03-18spirv: make generic globals invocation-localRobin Voetter
2024-03-18Add 64bit byteswap case, use fewer localsSuperAuguste
2024-03-18Merge pull request #19334 from antlilja/llvm-fast-mathVeikka Tuominen
Fix setFloatMode in LLVM backend
2024-03-17Merge pull request #19333 from Vexu/fixesAndrew Kelley
Miscellaneous error fixes
2024-03-17Ast: fix comptime destructureJacob Young
A preceding `comptime` keyword was being ignored if the first destructure variable was an expression.
2024-03-17add behavior test for optimized float mathVeikka Tuominen
Closes #19178
2024-03-17Sema: allow param instructions to clobber inst_mapVeikka Tuominen
Closes #18840
2024-03-17Sema: fix spurious type has no namespace errorVeikka Tuominen
Closes #19232
2024-03-17AstGen: disallow alignment on function typesJacob Young
A pointer type already has an alignment, so this information does not need to be duplicated on the function type. This already has precedence with addrspace which is already disallowed on function types for this reason. Also fixes `@TypeOf(&func)` to have the correct addrspace and alignment.
2024-03-15test: reenable some behavior vector testsMeghan Denny
2024-03-11std.builtin: make atomic order fields lowercaseTristan Ross
2024-03-11std.builtin: make float mode fields lowercaseTristan Ross
2024-03-11std.builtin: make link mode fields lowercaseTristan Ross
2024-03-11std.builtin: make container layout fields lowercaseTristan Ross
2024-03-09Sema: perform codegen for anon decl created by `@extern`mlugg
This fixes a bug where, at least with the LLVM backend, `@extern` calls which had the same name as a normal `extern` in the same Zcu would result in the `@extern` incorrectly suffixing the identifier `.2`. Usually, the LLVM backend has a system to change the generated globals to "collapse" them all together, but it only works if `updateDecl` is called!
2024-03-08Sema: reset block error return trace index between casesmlugg
Resolves: #19210
2024-03-06behavior: add tests for #18816mlugg
2024-03-06behavior: correct tests after #18816mlugg
2024-03-05Sema: fix compiler crash `@ptrCast`ing optional slicegarrison hinson-hasty
2024-03-02Air: replace `.dbg_inline_*` with `.dbg_inline_block`Jacob Young
This prevents the possibility of not emitting a `.dbg_inline_end` instruction and reduces the allocation requirements of the backends. Closes #19093
2024-02-27Merge pull request #19062 from mlugg/dbg-var-blocksMatthew Lugg
compiler: decide dbg_var scoping based on AIR blocks
2024-02-26Fix tuple default valuesJohn Schmidt
- Add default values to the list of comptime-known elements in `zirValidatePtrArrayInit` - In `structFieldValueComptime`, only assert `haveFieldInits` if we enter the`fieldIsComptime` branch (otherwise they are not needed).
2024-02-26Merge pull request #18859 from schmee/switch-union-capture-alignAndrew Kelley
Sema: preserve field alignment in union pointer captures
2024-02-26Sema: evaluate generic instantiations in fn decls capture scopeJohn Schmidt
The generic call `S.foo()` was evaluated with the capture scope of the owner decl (i.e the `test` block), when it should use the capture scope of the function declaration.
2024-02-26compiler: decide dbg_var scoping based on AIR blocksmlugg
This commit eliminates the `dbg_block_{begin,end}` instructions from both ZIR and AIR. Instead, lexical scoping of `dbg_var_{ptr,val}` instructions is decided based on the AIR block they exist within. This is a much more robust system, and also results in a huge drop in ZIR bytes - around 7% for Sema.zig. This required some enhancements to Sema to prevent elision of blocks when they are required for debug variable scoping. This can be observed by looking at the AIR for the following simple test program with and without `-fstrip`: ```zig export fn f() void { { var a: u32 = 0; _ = &a; } { var a: u32 = 0; _ = &a; } } ``` When `-fstrip` is passed, no AIR blocks are generated. When `-fno-strip` is passed, the ZIR blocks are lowered to true AIR blocks to give correct lexical scoping to the debug vars. The changes here incidentally reolve #19060. A corresponding behavior test has been added. Resolves: #19060
2024-02-25x86_64: implement optional comparisonsJacob Young
Closes #18959
2024-02-25Sema: implement vector coercionsJacob Young
These used to be lowered elementwise in air, and now are a single air instruction that can be lowered elementwise in the backend if necessary.
2024-02-25x86_64: implement `@shuffle`Jacob Young
2024-02-25x86_64: implement `@select`Jacob Young
2024-02-22Module: fix `@embedFile` of files containing zero bytesJacob Young
If an adapted string key with embedded nulls was put in a hash map with `std.hash_map.StringIndexAdapter`, then an incorrect hash would be entered for that entry such that it is possible that when looking for the exact key that matches the prefix of the original key up to the first null would sometimes match this entry due to hash collisions and sometimes not if performed later after a grow + rehash, causing the same key to exist with two different indices breaking every string equality comparison ever, for example claiming that a container type doesn't contain a field because the field name string in the struct and the string representing the identifier to lookup might be equal strings but have different string indices. This could maybe be fixed by changing `std.hash_map.StringIndexAdapter.hash` to only hash up to the first null, therefore ensuring that the entry's hash is correct and that all future lookups will be consistent, but I don't trust anything so instead I assert that there are no embedded nulls.
2024-02-21Sema: fix peer type resolution for arrays of coercible elementsgarrison hinson-hasty
2024-02-20c_import: extract behavior tests that use `@cImport`Jacob Young
This introduces the new test step `test-c-import`, and removes the ability of the behavior tests to `@cImport` paths relative to `test`. This allows the behavior tests to be run without translate c.
2024-02-15test: skip new failing tests for spirvAli Chraghi
2024-02-15llvm: fix lowering of recursive debug infoJacob Young
This change allows recursing over types that are currently being resolved fully with a second pass of forward resolution. Closes #16414
2024-02-12x86_64: implement c abi for bool vectorsJacob Young
2024-02-12x86_64: fix packed loadJacob Young