Commit graph

6834 commits

Author SHA1 Message Date
Jacob Young
e60d667111 Module: fix @embedFile of files containing zero bytes
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-22 12:33:53 -08:00
Jakub Konka
ddb33baa11 test/link/elf: test static linking C riscv64-musl 2024-02-21 23:08:29 +01:00
Jakub Konka
55dadc3d85 test/link/elf: test static linking C aarch64-musl 2024-02-21 22:40:03 +01:00
garrison hinson-hasty
955fd65cb1
Sema: fix peer type resolution for arrays of coercible elements 2024-02-21 00:55:29 +00:00
Jacob Young
ec7293422d llvm: fix c abi for structs not passed in registers
Closes #18916
2024-02-20 23:36:47 +01:00
Jacob Young
2291560424 c_import: extract behavior tests that use @cImport
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-20 18:44:43 +01:00
mlugg
65a87ff299 Liveness: do not elide safety-checked instructions
Resolves: #19012
2024-02-20 12:10:29 +00:00
mlugg
7461309b73 Sema: validate that runtime-known inferred alloc does not have comptime-only type
Resolves: #18997
2024-02-19 21:48:50 +00:00
Robin Voetter
dd4d320eb9
Merge pull request #18948 from alichraghi/vector
spirv: use extended instructions whenever possible
2024-02-17 14:01:07 +01:00
mlugg
b2f28a104d
cases: account for changed compile errors 2024-02-16 12:15:39 +00:00
Jacob Young
6f08e17229 InternPool: make more use of NullTerminatedString.Slice
This should avoid the random pointer invalidation crashes.

Closes #18954
2024-02-16 00:27:25 -08:00
Andrew Kelley
2176a73d66 disable flaky C backend test
See tracking issue #18954
2024-02-15 18:32:36 -07:00
Ali Chraghi
66e6d0d314 test: skip new failing tests for spirv 2024-02-15 18:44:24 +03:30
Paul Berg
885f40520e c_abi: add vector tests for floats 2024-02-15 13:17:46 +01:00
Paul Berg
42446e6bf9 wasm: enable bool vectors tests for stage2_llvm 2024-02-15 13:17:37 +01:00
Jacob Young
6fe90a913a llvm: fix lowering of recursive debug info
This change allows recursing over types that are currently being
resolved fully with a second pass of forward resolution.

Closes #16414
2024-02-15 02:46:18 -08:00
Veikka Tuominen
51d67c7c8f Sema: add declared here notes in fail
This ensures that the note is added in more places and that `errMsg` needs to be used in fewer places.
2024-02-12 12:54:32 -08:00
Jacob Young
a9f738e56b x86_64: implement c abi for bool vectors 2024-02-12 05:25:07 +01:00
Jacob Young
5a62f26579 x86_64: fix packed load 2024-02-12 05:25:07 +01:00
Jacob Young
f2a62d25fc x86_64: implement ret_safe 2024-02-12 05:25:07 +01:00
Jacob Young
6235762c09 x86_64: implement mul, div, and mod of large integers
This enables the last compiler-rt test disabled for the x86_64 backend.
2024-02-12 05:25:07 +01:00
Andrew Kelley
616f74ba20 add behavior test for recently fixed wasm backend bug
Adds the corresponding behavior test for the fix in
320c4d68f5.
2024-02-11 14:14:59 -07:00
Jakub Konka
d12c8db642
Merge pull request #18875 from ziglang/macho-zo-dwarf
macho: emit DWARF for ZigObject relocatable
2024-02-09 23:12:04 +01:00
Veikka Tuominen
731ff120d0 Sema: catch runtime stores to comptime variables through calls 2024-02-09 13:51:51 -08:00
Andrew Kelley
54bbc73f85
Merge pull request #18712 from Vexu/std.options
std: make options a struct instance instead of a namespace
2024-02-09 13:38:42 -08:00
Tristan Ross
2a3e601f77 test.link.macho: fix for non-x86 and arm architectures
This fix is requires to make the build runner even compile when building
Zig on architectures like RISC-V.
2024-02-09 17:49:53 +02:00
Ali Chraghi
37b0aa600a spirv: make rusticl the primary testing implementation 2024-02-09 09:27:08 +03:30
Jakub Konka
925273bcc8 macho: align memory size with file size when emitting relocatable 2024-02-09 00:20:11 +01:00
Jakub Konka
7388534590 test/link/macho: more self-hosted tests 2024-02-08 23:51:30 +01:00
John Schmidt
7cb227ab67 Polish a few tests in switch.zig
- Return `error.TestFailed` instead of panicing
- Use `comptime assert` for type checks so that errors surface at
  compile time
2024-02-08 23:49:03 +01:00
John Schmidt
0d1baf0c61 Improvements after code review 2024-02-08 23:49:03 +01:00
John Schmidt
dbcd53def0 Preserve field alignment in union pointer captures 2024-02-08 23:49:03 +01:00
Jakub Konka
7fb9df3fab test/link/macho: -fstrip is no longer needed for self-hosted 2024-02-08 22:15:00 +01:00
David Rubin
24fb6d1f30
Make @intFromEnum an error for empty enums 2024-02-06 21:04:09 +02:00
Jakub Konka
52066bf8e4 x86_64+macho: pass more behavior tests 2024-02-06 19:01:17 +01:00
Andrew Kelley
5cf138e512 delete bad behavior test
As pointed out in the issue this behavior test branches on an undefined
value. That's not valid Zig code.

Also behavior tests should not depend on the standard library in this
manner. They need to minimally isolate the specific language thing that
is being tested.

Closes #12681
2024-02-05 23:47:05 -07:00
Robin Voetter
2511106150
spirv: air vector_store_element 2024-02-04 19:09:34 +01:00
Robin Voetter
9fbba0e01a
spirv: update tests 2024-02-04 19:09:33 +01:00
Robin Voetter
1d548aa2aa
spirv: air splat 2024-02-04 19:09:33 +01:00
Robin Voetter
76d5696434
spirv: air abs 2024-02-04 19:09:32 +01:00
Robin Voetter
631d1b63a8
spirv: fix shuffle properly 2024-02-04 19:09:32 +01:00
Robin Voetter
9641d2ebdb
spirv: vectorize max, min 2024-02-04 19:09:31 +01:00
Robin Voetter
9f0227a326
spirv: vectorize int_cast, trunc 2024-02-04 19:09:31 +01:00
Robin Voetter
408c117246
spirv: air is_(non_)null_ptr, optional_payload_ptr 2024-02-04 19:09:30 +01:00
Robin Voetter
7dfd403da1
spirv: air mul_add 2024-02-04 19:09:30 +01:00
Robin Voetter
345d6e280d
spirv: air int_from_bool 2024-02-04 19:09:29 +01:00
Robin Voetter
b67d983abd
spirv: vectorize add/sub overflow 2024-02-04 19:09:27 +01:00
Robin Voetter
761594e226
spirv: reduce, reduce_optimized 2024-02-04 19:09:27 +01:00
Robin Voetter
2f815853dc
spirv: shlWithOverflow 2024-02-04 19:09:26 +01:00
Robin Voetter
15cf5f88c1
spirv: vectors for air not 2024-02-04 19:09:25 +01:00