Commit Graph

6761 Commits

Author SHA1 Message Date
Carl Åstholm
5d5e89aa8d Promote linker test cases to packages 2024-04-07 16:05:54 -07:00
Carl Åstholm
33b8fdb6bc Turn "simple" standalone test cases into a package 2024-04-07 16:05:54 -07:00
Carl Åstholm
c3ecc6972e Don't add standalone test cases until we've built stage3 2024-04-07 16:05:54 -07:00
Carl Åstholm
d6ecfa7025 Move "simple" standalone test cases to a new directory 2024-04-07 16:05:54 -07:00
Carl Åstholm
3ed221f149 Promote standalone test cases to packages
This is a prerequisite for removing `b.anonymousDependency()`, but
having compiler tests dogfood package management might be a good idea
in general.
2024-04-07 16:05:53 -07:00
Andrew Kelley
e204a6edb8
Merge pull request #18988 from castholm/lazy-build-zig
std.Build: add `lazyImport` (`@import` for lazy dependencies)
2024-04-07 15:43:54 -07:00
Carl Åstholm
278db0ad45 Sema: support coercing ref to anonymous array init to many-pointer 2024-04-07 15:10:49 -07:00
Carl Åstholm
eee5400b7d Account for dependency boundaries when duping headers
This is a temporary workaround that can be revered if/when 'path'
lazy paths are updated to encode which build root they are relative to.
2024-04-07 15:34:47 +02:00
Carl Åstholm
d99e44a157 Document added/updated functions
Also renames `addHeaders` to `addHeadersDirectory` for clarity.
2024-04-07 15:34:47 +02:00
Carl Åstholm
5af4e91e00 Oops, forgot to dupe installations in installLibraryHeaders
Added test coverage for `installLibraryHeaders`
2024-04-07 15:34:47 +02:00
Carl Åstholm
7b1a6a93a4 Fix install_headers test on macOS (and possibly Linux) 2024-04-07 15:34:47 +02:00
Carl Åstholm
27c8f895eb Add standalone tests for Compile.installHeaders
Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
2024-04-07 15:34:47 +02:00
Carl Åstholm
9181ecd951 Sema: fix runtime call of inline fn with comptime-known comptime-only ret type 2024-04-07 15:07:55 +02:00
Andrew Kelley
f45ba7d0c1
Merge pull request #19562 from Snektron/spirv-remove-cache
spirv: remove cache
2024-04-06 13:03:22 -07:00
Jacob Young
f668c8bfd6 x86_64: fix abi of nested structs 2024-04-06 13:02:55 -07:00
Jacob Young
4a8121c1ab Sema: fix non-pub usingnamespace in @typeInfo 2024-04-06 12:57:51 -07:00
Jacob Young
4e85536604 Builder: fix encoding big integers in bitcode
Closes #19543
2024-04-06 12:53:09 -07:00
Robin Voetter
ac16545895
spirv: enable passing tests 2024-04-06 13:52:48 +02:00
Ali Chraghi
436f53f55d spirv: implement @mulWithOverflow 2024-04-06 09:01:46 +03:30
Ali Chraghi
0f75143c62 spirv: implement @divFloor, @floor and @mod 2024-04-06 08:50:02 +03:30
Ali Chraghi
14e3718723 spirv: make behavior tests passing 2024-04-05 00:13:48 +03:30
Jacob Young
4794c6a526 Sema: fix crash accessing array of opv types
Closes #19499
2024-04-02 13:45:07 -07:00
Robin Voetter
d2be725e4b
Merge pull request #19490 from Snektron/spirv-dedup
spirv: deduplication pass
2024-04-01 09:51:04 +02:00
Jacob Young
eb723a4070 Update uses of @fieldParentPtr to use RLS 2024-03-30 20:50:48 -04:00
Jacob Young
17673dcd6e AstGen: use RLS to infer the first argument of @fieldParentPtr 2024-03-30 20:50:48 -04:00
Jacob Young
e409afb79b Update uses of @fieldParentPtr to pass a pointer type 2024-03-30 20:50:48 -04:00
Jacob Young
9b2345e182 Sema: rework @fieldParentPtr to accept a pointer type
There is no way to know the expected parent pointer attributes (most
notably alignment) from the type of the field pointer, so provide them
in the first argument.
2024-03-30 20:50:48 -04:00
Jacob Young
5a41704f7e cbe: rewrite CType
Closes #14904
2024-03-30 20:50:48 -04:00
Robin Voetter
27b91288dc
spirv: disable failing tests 2024-03-30 19:47:56 +01:00
Robin Voetter
12350f53bf
spirv: clz, ctz for opencl
This instruction seems common in compiler_rt.
2024-03-30 19:47:55 +01:00
Veikka Tuominen
2d443cdabf Sema: allow .ptr on pointer to array 2024-03-29 07:10:57 +02:00
Andrew Kelley
3661133f98
Merge pull request #19399 from ypsvlq/mingw
mingw: support -municode
2024-03-28 14:16:30 -07:00
Veikka Tuominen
9106fdffaf Sema: check error union payload types in @errorCast 2024-03-28 15:39:47 +02:00
Veikka Tuominen
60614b2a85 add tests for fixed stage1 bugs
Closes #10357
Closes #11236
Closes #11615
Closes #12055
2024-03-28 15:24:01 +02:00
Veikka Tuominen
2cdc48a632 remove test/cbe.zig
The C backend is far enough along for these tests to be redundant with all the other tests.
2024-03-28 15:24:01 +02:00
HydroH
7aa42f47b7
allow @errorcast to cast error sets to error unions 2024-03-28 10:23:32 +00:00
Ryan Liptak
bad9efbcc1 Add standalone test for all possible MinGW exe entry points 2024-03-27 10:06:06 +00:00
HydroH
7684423c08 translate-c: handle string concatenation of function calls 2024-03-26 21:16:53 -07:00
mlugg
845226a7c9
cases: necessary changes from branch 2024-03-26 17:06:14 +00:00
mlugg
152a2ceaf7
compiler: audit uses of ptr.addr in the frontend
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-26 13:48:06 +00:00
mlugg
f8b8259e5c
behavior: skip newly failing test
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-25 14:49:41 +00:00
mlugg
9c3670fc93
compiler: implement analysis-local comptime-mutable memory
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-25 14:49:41 +00:00
Andrew Kelley
90c94a2f0b disable failing behavior test: "reinterpret extern union"
see tracking issue #19389
2024-03-21 20:09:20 -07:00
Andrew Kelley
3eb260f042 disable failing behavior test: "comptime bitcast with fields following f80"
see tracking issue #19387
2024-03-21 19:07:08 -07:00
Andrew Kelley
af09d93925 disable failing behavior test: "bitcast packed union to integer"
see tracking issue #19384
2024-03-21 15:54:40 -07:00
Andrew Kelley
4d5e0a0434 Revert the last two commits in this branch
When the slice-by-length start position is runtime-known, it is likely
protected by a runtime-known condition and therefore a compile error is
less appropriate than a runtime panic check.

This is demonstrated in the json code that was updated and then reverted
in this commit.

When #3806 is implemented, this decision can be reassessed.

Revert "std: work around compiler unable to evaluate condition at compile time"
Revert "frontend: comptime array slice-by-length OOB detection"

This reverts commit 7741aca96c.
This reverts commit 2583b389ea.
2024-03-20 17:29:06 -07:00
Andrew Kelley
2583b389ea frontend: comptime array slice-by-length OOB detection 2024-03-20 17:02:35 -07:00
Andrew Kelley
ab22844176 frontend: add missing bounds check for slice-by-length arrays
closes #18382
2024-03-20 16:29:46 -07:00
Andrew Kelley
8c94950c24 fix compilation failures found by CI 2024-03-19 16:18:18 -07:00
Robin Voetter
7057bffc14
Merge pull request #19337 from Snektron/spirv-globals
spirv: rework generic global
2024-03-19 09:34:59 +01:00