5577 Commits

Author SHA1 Message Date
Jacob Young
f4b411314c Sema: defer stores to inferred allocs
This lets us generate the store with knowledge of the type to be stored.
Therefore, we can avoid generating garbage Air with stores through
pointers to comptime-only types which backends cannot lower.

Closes #13410
Closes #15122
2023-04-02 18:05:44 +03:00
Jacob Young
f4359531b1 x86_64: implement shl with overflow 2023-04-02 06:11:12 -04:00
Jacob Young
0e289cc826 x86_64: implement large add/sub with overflow 2023-04-02 05:16:46 -04:00
Jacob Young
b80cdde4f0 x86_64: implement struct_field_val for large packed structs 2023-04-02 04:49:53 -04:00
Jacob Young
83a208c355 x86_64: implement large cmp 2023-04-02 04:49:53 -04:00
Jacob Young
677427bc3a x86_64: implement error name 2023-04-02 04:49:53 -04:00
Jacob Young
ac68d72d24 x86_64: implement aggregate init of a packed struct 2023-04-02 04:49:53 -04:00
Jakub Konka
43a6384e9c link-test: adjust test/link/bugs/macho/13056 to latest changes on macOS 13.3
Latest macOS 13.3 rolled out LLVM 15 and thus the way `nullptr_t` is
defined within the `libc++`:

157bbe6aea

This seems to require including `/usr/include` with `-isystem` directive
rather than `-I`. Otherwise we get clang miscompilation issues due to
missing `nullptr_t` declaration.
2023-04-02 10:18:43 +02:00
Jakub Konka
e0bf7b6424 link-test: skip foreign checks in entry_in_archive MachO test 2023-04-01 20:02:33 +02:00
Jakub Konka
a88c0b4d08 link: handle -u flag in all linkers
Also clean up parsing of linker args - reuse `ArgsIterator`.

In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.

MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.
2023-04-01 14:22:44 +02:00
Jakub Konka
5d0bb50e3d link-test: add test for entry in a dynamic library for MachO 2023-04-01 14:22:44 +02:00
Jakub Konka
3874df839d link-test: add test for entry in a static archive for MachO 2023-04-01 14:22:44 +02:00
Jacob Young
0543def52f llvm: fix crashes when loading a struct field
The result of buildStructGEP is not always a GEP (sorry), so we can't
use getGEPResultElementType on it.

Closes #14641
2023-03-30 11:54:24 +03:00
dweiller
ff97bd21c3 tests: enable test_runner_module_imports standalone test 2023-03-30 11:53:07 +03:00
Jacob Young
dd66e0addb Sema: fix empty slice pointer value
We just checked that inst_child_ty was effectively a zero-bit type, so
it is certainly not the non-zero alignment we are looking for.

Closes #15085
2023-03-28 23:12:19 +03:00
Jakub Konka
1c5f255789 tests: enable multi-threaded x86_64-windows tests with self-hosted 2023-03-28 15:49:26 +02:00
Jacob Young
802c2e4fae x86_64: fix popcnt and disable regressed test 2023-03-27 05:58:00 -04:00
Jakub Konka
32591c1d99
Merge pull request #15076 from jacobly0/x86_64-backend
x86_64: implement things
2023-03-26 17:31:42 +02:00
Veikka Tuominen
4a5628e730 Module: fix lazy srcloc resolution for new for loop syntax
Closes #15081
2023-03-26 15:14:03 +03:00
Jacob Young
a80be15cd4 behavior: disable multi threaded for the stage2_x86_64 windows target
See #15075 for more details.
2023-03-25 16:23:55 -04:00
Jacob Young
1e080e5056 x86_64: implement atomic loops 2023-03-25 16:23:55 -04:00
Jacob Young
6d9bdc8733 x86_64: fix cmpxchg 2023-03-25 16:23:55 -04:00
Jacob Young
8f385e77ca x86_64: implement struct_field_val for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
0cfc0d0d13 x86_64: implement struct_field_ptr for packed containers 2023-03-25 16:23:55 -04:00
Jacob Young
935ec9ec6a x86_64: canonicalize each br of a block 2023-03-24 17:57:58 -04:00
Jacob Young
12c07fcf20 x86_64: fix more value tracking bugs 2023-03-24 17:57:58 -04:00
Jacob Young
dbe1b4a7e5 x86_64: fix value tracking bugs 2023-03-24 17:57:58 -04:00
Jakub Konka
145f93ba96 build: allow for deferred FileSource matching in CheckObjectStep
Re-enable all of functionality of MachO dylib test.
2023-03-23 23:46:53 +01:00
Veikka Tuominen
87e07d8671 fix broken test cases exposed by ec445fb6b8bb3f3d423cafa4f3a7860da65ca233
shoulda rebased
2023-03-21 20:57:14 +02:00
John Schmidt
ec445fb6b8 Improve error messages for break type coercion 2023-03-21 15:09:42 +02:00
mlugg
f9b5829508 Sema: implement @export for arbitrary values 2023-03-21 15:04:39 +02:00
Xavier Bouchoux
898e4473e8 CBE: implement aggregateInit() for array of array case.
fixes `error(compilation): clang failed with stderr: error: array type 'uint32_t[10]' (aka 'unsigned int[10]') is not assignable`
2023-03-21 14:56:04 +02:00
Veikka Tuominen
f7204c7f37
Merge pull request #15028 from Vexu/compile-errors
Sema: improve error message of field access of wrapped type
2023-03-21 14:55:36 +02:00
Jacob Young
f316cb29cc x86_64: implement atomic and fence ops 2023-03-21 08:49:54 +01:00
Jacob Young
3f4569bf18 codegen: fix backend breakage due to optional layout change 2023-03-21 08:49:54 +01:00
Jacob Young
f95faac5ae x86_64: (re)implement optional ops
Note that this commit also changes the layout of optional for all
other backends using `src/codegen.zig` without updating them!
2023-03-21 08:49:54 +01:00
Jacob Young
24f0900ecb x86_64: implement some error union ops 2023-03-21 08:49:54 +01:00
Jacob Young
80427796df x86_64: implement @returnAddress and @frameAddress 2023-03-21 08:49:54 +01:00
Jacob Young
30e1daa746 x86_64: implement basic float ops 2023-03-21 08:49:54 +01:00
Veikka Tuominen
e70a0b2a6b Value: implement reinterpreting enum field index as integer
Closes #15019
2023-03-21 03:31:03 +02:00
Jacob Young
bc0f246911 tests: add -Dskip-cross-glibc option
It is reasonable to pass -Dskip-non-native when unable to run foreign
binaries, however there is no option for being able to run foreign
static binaries but unable to run foreign dynamic binaries.  This can
occur when qemu is installed but not cross glibc.
2023-03-20 21:00:06 -04:00
mlugg
3a25f6a22e Port some stage1 test cases to stage2
There are now very few stage1 cases remaining:
* `cases/compile_errors/stage1/obj/*` currently don't work correctly on
  stage2. There are 6 of these, and most of them are probably fairly
  simple to fix.
* `cases/compile_errors/async/*` and all remaining `safety/*` depend on
  async; see #6025.

Resolves: #14849
2023-03-20 19:55:50 -04:00
Veikka Tuominen
82133cd992 Sema: improve error message of field access of wrapped type
Closes #15027
2023-03-21 00:34:12 +02:00
Veikka Tuominen
9d9815fb9c Value: handle comparisons of runtime_values
Closes #15004
2023-03-21 00:34:12 +02:00
Veikka Tuominen
773b1c4c5c llvm: fix lowering packed union initiated to zero-bit value
Closes #14980
2023-03-21 00:34:12 +02:00
Luuk de Gram
322ace70f9
Merge pull request #14838 from Luukdegram/bss-fix
wasm-linker: fix storing atoms in the correct segment
2023-03-19 15:42:39 +01:00
Andrew Kelley
8f481dfc3c fix std.Build.OptionsStep
* use the same hash function as the rest of the steps
 * fix race condition due to a macOS oddity.
 * fix race condition due to file truncation (rename into place instead)
 * integrate with marking Step.result_cached. check if the file already
   exists with fs.access before doing anything else.
 * use a directory so that the file basename can be "options.zig"
   instead of a hash digest.
 * better error reporting in case of file system failures.
2023-03-19 00:39:29 -04:00
Luuk de Gram
d0fb1ef962
wasm-link: update bss linker test
Updates the linker test to verify the various cases where we must
store the data in the bss segment.
2023-03-18 16:47:12 +01:00
mlugg
71e873703f Sema: make @returnAddress return 0 at comptime
See also #14938.

Resolves: #14931
2023-03-17 15:55:02 -04:00
mlugg
4ec299007a Sema: allow dereferencing ill-defined pointers to zero-bit types at comptime
It doesn't matter if a pointer to a zero-bit (i.e. OPV) type is
undefined or runtime-known; we still know the result of the dereference
at comptime. Code may use this, for instance, when allocating zero-bit
types: `@as(*void, undefined)` is entirely reasonable to use at runtime,
since we know the pointer will never be accessed, thus it should be
valid at comptime too.
2023-03-17 01:56:36 -04:00