Commit Graph

26668 Commits

Author SHA1 Message Date
Andrew Kelley
ba9e38847a sema: remove source location logic in zirExportValue
`.unneeded` source location should never be passed when the source
location is in fact available.
2023-10-26 17:12:17 -07:00
Michael Dusan
da06269d70 std.target: bump some OS max versions
- freebsd, openbsd, macos, ios, watchos, tvos
2023-10-26 19:18:37 -04:00
Krzysztof Wolicki
a9e66ed730 Step.Options: @typeName gives a fully qualified name so the test needs to reflect that 2023-10-26 13:56:43 +03:00
Andrew Kelley
ba817fae8f
Merge pull request #17690
Sema: move remaining anon decls to new mechanism
2023-10-26 03:49:16 -04:00
Andrew Kelley
cf9735a5e0 link: Coff, MachO, and Wasm all had the same UAF bug 2023-10-25 20:24:05 -07:00
Andrew Kelley
098a07dc45 link.Elf: fix UAF in lowerAnonDecl
The main problem being fixed here is there was a getOrPut() that held on
to a reference to the value pointer too long, and meanwhile the call to
`lowerConst` ended up being recursive and mutating the hash map,
invoking undefined behavior.

caught via #17719
2023-10-25 19:57:02 -07:00
Andrew Kelley
cbcef2d806 C backend: remove some @as 2023-10-25 19:57:02 -07:00
Jacob Young
51f7e5412a cbe: update DeclGen.decl_index to support anon decls 2023-10-25 19:57:02 -07:00
Andrew Kelley
405ba2680f Sema: replace refValue with simpler implementation
Move some more anon decls to the new mechanism
2023-10-25 19:57:02 -07:00
Andrew Kelley
03b473d21b Sema: rework addConstantMaybeRef
and add anonDeclRef and migrate some anon decls to it
2023-10-25 19:57:02 -07:00
Andrew Kelley
f841b265c5 Sema: move @typeInfo anon decls to new mechanism 2023-10-25 19:57:02 -07:00
Andrew Kelley
426b5982d7 Sema: move some TODO comments to an issue
Tracking issue: #17689
2023-10-25 19:57:02 -07:00
Andrew Kelley
7a106645fd Sema: migrate @src to new anon decl mechanism 2023-10-25 19:57:02 -07:00
Jakub Konka
cc394431ae
Merge pull request #17699 from ziglang/elf-better-alloc
elf: allocated PHDR table always immediately succeeding the EHDR
2023-10-25 23:25:56 +02:00
Jakub Konka
10ea7accf7
Merge pull request #17706 from ziglang/elf-error-tests
elf: test error generation
2023-10-25 23:20:12 +02:00
frmdstryr
5c5d1f93c4 Update comment on for_range in Ast
The rhs can be omitted eg `0..`
2023-10-25 14:09:34 -04:00
Jacob Young
ed00afbc4c Coff: fix use after free 2023-10-25 12:23:21 -04:00
Jacob Young
868d592580 builtin: implement default_panic for plan9
Also disable default panic handler when not using elf.
2023-10-25 08:20:11 -04:00
Jakub Konka
bc081901dc Step.Compile: differentiate between fuzzy and exact matches for compile errors 2023-10-25 11:40:16 +02:00
Jacob Young
b55377a5ab x86_64: pass more tests
* 128-bit integer multiplication with overflow
 * more instruction encodings used by std inline asm
 * implement the `try_ptr` air instruction
 * follow correct stack frame abi
 * enable full panic handler
 * enable stack traces
2023-10-25 04:28:30 -04:00
Jakub Konka
030da45c8e elf: estimate max number of phdrs that can be emitted 2023-10-25 04:27:44 -04:00
Jakub Konka
e1248b693f elf: allocate PHDR table always succeeding the EHDR
While this is a less flexible approach to being able to
allocated the PHDR anywhere in file, it is sadly generally expected
by the tooling in the wild.
2023-10-25 04:27:44 -04:00
Jakub Konka
0a04bd87ba elf: use std.math.maxInt(u64) as signal that shdr/phdr not allocated yet 2023-10-25 04:27:44 -04:00
frmdstryr
f30ab46306 Update comment on Tag value assign_mod in Ast.zig 2023-10-25 09:31:27 +03:00
Nameless
6c9d34bce7
std.Uri: prevent crash with strange authority section 2023-10-25 09:30:24 +03:00
Jakub Konka
55c7a6d99d elf: test unknown file type error 2023-10-24 23:11:50 +02:00
Jakub Konka
bc9ab3a613 elf: test mismatched cpu architecture error 2023-10-24 22:48:55 +02:00
Jakub Konka
c9c210a4e7 elf: test path errors in ld script parsing 2023-10-24 22:31:25 +02:00
Jakub Konka
403e539669 elf: test unresolved symbol reference error 2023-10-24 22:08:36 +02:00
Jakub Konka
89563f07e3 build: match and ignore /?/ in expected compile errors 2023-10-24 22:08:36 +02:00
Andrew Kelley
22a6a5d93f
Merge pull request #17691 from mlugg/no-interned-runtime-value
Remove `InternPool.Key.runtime_value`, clean up Sema value resolution functions
2023-10-24 14:57:55 -04:00
Tobias Simetsreiter
d1230842ac add Fetch support for short compressed tar ext
these short extensions are common in a lot of
places, and should be treated like their double
versions
2023-10-24 13:49:28 -04:00
Jakub Konka
8087ec8e8c elf: improve parsing of ld scripts and actually test linking against them 2023-10-24 19:03:00 +02:00
XXIV
2f3add4f30 build.zig.zon.md: remove duplicate word 2023-10-24 17:46:10 +03:00
mlugg
f2814caaf0
Sema: don't allow undef values through resolveDefinedValue in typeof block
This logic is not correct in most cases. If any instruction needs to
operate with different semantics within `@TypeOf`, it should be made to
do so explicitly.

This broke a line in `std.mem`: I have opted to fix this in std for now,
since as far as I know it's not yet been discussed which operations (if
any) should be special-cased like this within `@TypeOf`.
2023-10-24 14:28:34 +01:00
mlugg
67caf68505
Sema: rename value resolution functions
Having simplified these functions in a previous commit, I felt inclined
to refactor their names, which were previously quite inconsistent. There
are now 4 "core" functions:

* `resolveValue` (previously `resolveMaybeUndefVal`) allows runtime-known and undef values.
* `resolveConstValue` (previously `resolveConstMaybeUndefVal`) allows undef but not runtime-known values.
* `resolveDefinedValue` (name unchanged) allows runtime-known values but not comptime-known undef.
* `resolveConstDefinedValue` (previously `resolveConstValue`) does not allow runtime-known or undef values.

You can see the inconsistencies in the old names here - sometimes we
specified "maybe undef", and sometimes we went the other way by
specifying "defined". With the new names, the most common function,
`resolveValue`, has the shortest name and does the most general thing,
and is the baseline that the other functions are adding logic to.

Some other functions were also renamed:
* `resolveMaybeUndefLazyVal` -> `resolveValueResolveLazy`
* `resolveMaybeUndefValIntable` -> `resolveValueIntable`
* `resolveMaybeUndefValAllowVariables` -> `resolveValueAllowVariables`
2023-10-24 14:28:34 +01:00
mlugg
7882bdcb7e
Value: remove unused function 2023-10-24 14:28:33 +01:00
mlugg
20bb81166f
InternPool: remove runtime_value representation
The main goal of this commit is to remove the `runtime_value` field from
`InternPool.Key` (and its associated representation), but there are a
few dominos. Specifically, this mostly eliminates the "maybe runtime"
concept from value resolution in Sema: so some resolution functions like
`resolveMaybeUndefValAllowVariablesMaybeRuntime` are gone. This required
a small change to struct/union/array initializers, to no longer
use `runtime_value` if a field was a `variable` - I'm not convinced this
case was even reachable, as `variable` should only ever exist as the
trivial value of a global runtime `var` decl.

Now, the only case in which a `Sema.resolveMaybeUndefVal`-esque function
can return the `variable` key is `resolveMaybeUndefValAllowVariables`,
which is directly called from `Sema.resolveInstValueAllowVariables`
(previously `Sema.resolveInstValue`), which is only used for resolving
the value of a Decl from `Module.semaDecl`.

While changing these functions, I also slightly reordered and
restructured some of them, and updated their doc comments.
2023-10-24 14:28:33 +01:00
Jacob Young
bb0419599a
Merge pull request #17666 from jacobly0/x86_64-unicode
x86_64: pass more std tests
2023-10-24 05:34:13 -04:00
Andrew Kelley
b477279c37
Merge pull request #17688 from ziglang/comptime-src
Sema: make `@src().line` comptime-known
2023-10-24 03:58:47 -04:00
Andrew Kelley
b798aaf499
Merge pull request #17687
frontend: rework `@embedFile` for incremental compilation
2023-10-24 01:14:09 -04:00
Jacob Young
f7482a5c95 x86_64: implement inline asm GOT reference for PIC targets 2023-10-23 22:42:18 -04:00
Jacob Young
8f69e977f1 x86_64: implement 128-bit builtins
* `@clz`
 * `@ctz`
 * `@popCount`
 * `@byteSwap`
 * `@bitReverse`
 * various encodings used by std
2023-10-23 22:42:18 -04:00
Jacob Young
fbe8c8938b x86_64: implement @mod for floating-point types 2023-10-23 22:42:18 -04:00
Jacob Young
fe93332ba2 x86_64: implement enough to pass unicode tests
* implement vector comparison
 * implement reduce for bool vectors
 * fix `@memcpy` bug
 * enable passing std tests
2023-10-23 22:42:18 -04:00
Andrew Kelley
794dc694b1
Merge pull request #17686 from ziglang/elf-non-nixos
elf: fix linking against system libc libs
2023-10-23 22:39:57 -04:00
Andrew Kelley
c01aa26bd3 tracy: protect source info via global constant
When the code is written this way, you get a compile error if the
pointer given to Tracy does not have a static lifetime.

This would have caught the regression in #13315.
2023-10-23 18:36:00 -07:00
Andrew Kelley
46a6d50fdf Sema: make @src().line comptime-known
Reverts 89cef9f5f7.

Closes #13315
2023-10-23 18:35:10 -07:00
Andrew Kelley
d4911794ae rename behavior test to better describe what it does
In general, let's not lean on GitHub issue numbers as having meaning.
The goal of behavior tests is to produce a minimum set of tests that
test 100% of the language.
2023-10-23 17:28:10 -07:00
Andrew Kelley
3667489051 frontend: slightly simplify memory management
no reason to pass `keep_resolved_path` to `newEmbedFile`
2023-10-23 17:25:11 -07:00