Commit graph

6834 commits

Author SHA1 Message Date
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
Robin Voetter
2f9e37ade0
spirv: enable passing tests 2024-03-18 19:13:51 +01:00
Robin Voetter
4020b91f21
spirv: skip test that miscompiles on Intel 2024-03-18 19:13:51 +01:00
Robin Voetter
8ed134243a
spirv: unused instruction pruning linker pass 2024-03-18 19:13:50 +01:00
Robin Voetter
9b18125562
spirv: make generic globals invocation-local 2024-03-18 19:13:50 +01:00
SuperAuguste
8e7d9afdac Add 64bit byteswap case, use fewer locals 2024-03-18 12:40:41 +01:00
Veikka Tuominen
64173dadca
Merge pull request #19334 from antlilja/llvm-fast-math
Fix setFloatMode in LLVM backend
2024-03-18 04:27:39 +02:00
Andrew Kelley
95cb939440
Merge pull request #19333 from Vexu/fixes
Miscellaneous error fixes
2024-03-17 15:26:55 -07:00
Jacob Young
c11b6adf13 Ast: fix comptime destructure
A preceding `comptime` keyword was being ignored if the first
destructure variable was an expression.
2024-03-17 15:23:16 -07:00
Andrew Kelley
d981549d65
Merge pull request #19323 from jacobly0/rm-fn-type-align
AstGen: disallow alignment on function types
2024-03-17 15:19:54 -07:00
Veikka Tuominen
aa03ec8001 add behavior test for optimized float math
Closes #19178
2024-03-17 22:23:16 +02:00
antlilja
8ac5eb0893 LLVM: Add test for calling reduce with float mode set to optimized 2024-03-17 16:34:36 +01:00
Veikka Tuominen
436c72e89a Sema: allow param instructions to clobber inst_map
Closes #18840
2024-03-17 14:42:12 +02:00
Veikka Tuominen
fec4b7ef5c Sema: fix spurious type has no namespace error
Closes #19232
2024-03-17 14:42:12 +02:00
Veikka Tuominen
f983adfc10 Sema: fix printing of inferred error set of generic fn
Closes #19332
2024-03-17 13:33:05 +02:00
Anton Lilja
294f51814f
LLVM lowerDebugType: Lower union types without a layout into an empty namespace 2024-03-17 13:25:09 +02:00
Jacob Young
d10c52c194 AstGen: disallow alignment on function types
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-17 03:06:17 +01:00
Meghan Denny
4b1edad6e2 test: reenable some behavior vector tests 2024-03-15 16:42:10 +02:00
Jakub Konka
d565c5dfcd macho: fix a sad typo in calculating the address of a TLV pointer 2024-03-15 08:17:10 +01:00
Matthew Lugg
39459e78ad
Merge pull request #19273 from mlugg/incremental-some-more
compiler: more progress on incremental
2024-03-14 17:45:21 +00:00
Ahmed
5c8eda36d6 chore: Fix some typos 2024-03-14 19:43:24 +02:00
mlugg
48af67c152
Zcu: rename implicitly-named decls to avoid overriding by explicit decls 2024-03-14 07:40:05 +00:00
mlugg
00969062a9
compiler: detect duplicate test names in AstGen
There is no reason to perform this detection during semantic analysis.
In fact, doing so is problematic, because we wish to utilize detection
of existing decls in a namespace in incremental compilation.
2024-03-14 07:40:05 +00:00
Andrew Kelley
778ab767b1
Merge pull request #19258 from castholm/enums-eval-branch-quota
std.enums: Increase eval branch quotas
2024-03-13 18:50:12 -07:00
Jakub Konka
7ba2453b8e test/link/elf: do not check for $thunk in thunks tests for now
Andrew and I have discovered that on Linux max peak rss value
is taken to be `max(build_runner, test_suite)` and since the thunks
test emit a huge binary, we will easily exceed the declared maximum
for any of the test suites. This can be worked around for now by not
checking for $thunk symbols in this test since it doesn't really
yield any additional information; however ideally we would implement
per-thread local temp arena that can be freed.
2024-03-13 08:25:38 +01:00
Jakub Konka
faa4bdb017 elf+aarch64: fix off-by-one in converging on groups interleaved with thunks 2024-03-12 13:16:11 +01:00
Jakub Konka
b1bd3825f8 test/link/macho: remove redundant 'macho-' prefix from case names 2024-03-12 13:16:11 +01:00
Jakub Konka
b1eba5a996 elf+aarch64: actually write out thunks, and add a proper link test 2024-03-12 13:16:11 +01:00