Commit Graph

5361 Commits

Author SHA1 Message Date
Veikka Tuominen
327fb798c3 move stage2 compile errors out of special folder 2022-12-14 14:05:57 +02:00
IntegratedQuantum
0b4461d97b
Fix tautological big_int tests. 2022-12-14 00:29:25 +00:00
Andrew Kelley
6378644d4e
Merge pull request #13907 from Vexu/call-merge
Remove `stack` option from `@call`
2022-12-13 18:15:18 -05:00
Andrew Kelley
2e66b3be6e
Merge pull request #13910 from Luukdegram/wasm-simd 2022-12-13 14:11:22 -05:00
Meghan
3318611618 re-enable "signed zeros are represented properly" beahvior tests for f80 and c_longdouble 2022-12-13 13:33:16 +02:00
Veikka Tuominen
08b2d491bc update usages of @call 2022-12-13 13:14:20 +02:00
Luuk de Gram
37561a920b
wasm: enable passing vector tests 2022-12-12 17:42:09 +01:00
Coin
5e111098e5 Revert "compiler_c test: skip build modes on aarch64-windows"
This reverts commit c029a98f1c.
2022-12-12 04:58:10 +08:00
Coin
ed0ecd9bff Revert "mix_c_files: skip build modes on aarch64-windows due to bug"
This reverts commit cf543199ca.
2022-12-12 04:57:55 +08:00
IntegratedQuantum
15a6336bb4
Add a helpful note when using ** on number types. (#13871) 2022-12-11 14:41:42 -05:00
Andrew Kelley
74718a1183 disable failing CBE behavior tests failing on aarch64-windows
Also start to move redundant tests next to each other to make them
slightly more obvious that they need to be cleaned up.

See tracking issue #13876
2022-12-10 16:28:49 -07:00
Jakub Konka
c029a98f1c compiler_c test: skip build modes on aarch64-windows 2022-12-10 16:00:59 -07:00
Jakub Konka
cf543199ca mix_c_files: skip build modes on aarch64-windows due to bug 2022-12-10 16:00:59 -07:00
Andrew Kelley
cffbb32d31
Merge pull request #13872 from koachan/sparc64-codegen
stage2: sparc64: Some Air lowerings + skip unbuildable tests
2022-12-10 15:10:21 -05:00
Koakuma
f9e9ba784f stage2: sparc64: Skip unimplemented tests 2022-12-10 21:51:46 +07:00
Koakuma
fb9357f06c stage2: sparc64: Implement atomic ops 2022-12-10 21:11:14 +07:00
r00ster91
654e30069d behavior and cases: more test coverage for old issues
Closes #2622
Closes #2727
Closes #6047
Closes #6947
Closes #6656
2022-12-10 12:34:42 +01:00
r00ster91
bf863878ac behavior: add test coverage for slice and array-related issues
Closes #10684
Closes #6905
Closes #8646
2022-12-10 12:34:42 +01:00
r00ster91
7a8f7dcb8c behavior: add test coverage for corrupted slice in release
Closes #7325
2022-12-10 12:34:42 +01:00
r00ster91
01947bfe92 behavior: add test coverage for previous i128 regression on aarch64
Closes #8429
2022-12-10 12:34:42 +01:00
r00ster91
981cfd9c1c behavior and langref: reenable previously-regressed tests on aarch64 and powerpc64le
Closes #3282
2022-12-10 12:34:42 +01:00
r00ster91
3370d58956 aarch64: reenable tests that are no longer regressed
Closes #12013
Closes #10627
Closes #12027
2022-12-10 12:34:34 +01:00
r00ster91
75f8c04d6d behavior: add test coverage for slicing zero length array field of struct
Closes #11787
2022-12-10 12:33:17 +01:00
Veikka Tuominen
9d93b2ccf1 Eliminate BoundFn type from the language
Closes #9484
2022-12-09 20:37:18 -07:00
Veikka Tuominen
5831b68341 AstGen: add check for missing builtin argument
Closes #13817
2022-12-09 20:37:18 -07:00
Veikka Tuominen
ee9fc54cd0 TypedValue: fix handling of tuples represented as empty_struct_value 2022-12-08 22:21:49 +02:00
Veikka Tuominen
653c0bae0c remove stage1 specific compile error tests 2022-12-07 20:32:27 +02:00
Veikka Tuominen
dff32a2cd7 Sema: resolve lazy values in analyzeMinMax
Closes #13797
2022-12-07 14:48:24 +02:00
Andrew Kelley
1310ef7577 disable failing behavior tests with -ofmt=c -target x86_64-windows
and enable CI checks for the C backend on Windows.
2022-12-07 04:01:04 -05:00
Andrew Kelley
c8aba15c22 remove references to stage1 in behavior tests
Good riddance.
2022-12-06 19:06:48 -07:00
Andrew Kelley
b7b905d227 add behavior test for while(true) not needing else unreachable
closes #707
2022-12-06 17:57:27 -07:00
Andrew Kelley
57995c2100 translate-c: remove stage1 conditions from tests 2022-12-06 12:15:05 -07:00
Andrew Kelley
28514476ef remove -fstage1 option
After this commit, the self-hosted compiler does not offer the option to
use stage1 as a backend anymore.
2022-12-06 12:15:04 -07:00
Andrew Kelley
518392d6fe disable CBE behavior tests that are not passing in release modes 2022-12-04 15:57:40 -07:00
r00ster91
f094c4bce5 Sema: detect duplicate enum tag values 2022-12-04 14:12:24 +02:00
Jacob Young
e3b8658e65 cbe: add forward declarations for optionals and error unions
Arrays will have to wait for type rewrite.
2022-12-03 21:58:18 -05:00
Jacob Young
6d1292552e cbe: implement function alignment 2022-12-03 08:40:08 -05:00
Jacob Young
ec3116f573 cbe: fix zero-bit struct field pointer 2022-12-03 08:40:08 -05:00
Jacob Young
7fb6eb3d14 cbe: implement multiple exports of a symbols 2022-12-03 08:21:03 -05:00
Jacob Young
81c271cc62 cbe: don't emit extern decls that are already exported 2022-12-03 08:21:03 -05:00
Andrew Kelley
610d604f5b
Merge pull request #13748 from jacobly0/c-unaligned
cbe: use memcpy for underaligned loads and stores
2022-12-03 02:18:07 -05:00
Andrew Kelley
fdbb0fb7b9
Merge pull request #13744 from Vexu/stage2-fixes
Improve error messages, fix dependency loops
2022-12-03 00:42:11 -05:00
Jacob Young
e1216077f0 cbe: add support for constraint modifiers specified after a colon
This translates `%[name:mod]` to `%mod[name]` for C.
2022-12-02 22:21:24 -05:00
Jacob Young
fdedd62365 cbe: use memcpy for underaligned loads and stores 2022-12-02 22:21:24 -05:00
Andrew Kelley
29e8e67a7e CBE: use bool, true, false, instead of zig_ prefixes
In general the C backend should lower to human-maintainable C code
whenever possible. Directly using C types that one would use when
writing C code is one part of the strategy.

The concern with including stdint.h is C89 compatibility. Well, we can
just check the C std lib version before deciding to include that header.
2022-12-02 16:12:49 -07:00
Veikka Tuominen
b500e0eb17 Sema: add "parameter type declared here" note to type coercion 2022-12-03 00:48:04 +02:00
Veikka Tuominen
74285a4ed7 add test for error message improved by self-hosted
Closes #5099
2022-12-03 00:48:04 +02:00
Veikka Tuominen
f20e449fd6 Sema: improve error for mismatched type in implicit return
Closes #2653
2022-12-03 00:48:03 +02:00
Veikka Tuominen
e2509ddbe6 AstGen: add error for invalid string comparisons
These operations are allowed because the string literals are just
pointers but they produce unexpected results. These errors prevent
beginners from shooting themselves in the foot while still allowing
advanced users to circumvent them if they desire to do so.

Closes #8290
2022-12-03 00:09:23 +02:00
Veikka Tuominen
0e38cc16d5 Sema: fix comparisons between lazy and runtime values
Closes #12498
2022-12-03 00:09:23 +02:00
Veikka Tuominen
7f9e841f74 Sema: do not forcibly canonicalize unresolved pointer element type
Closes #13308
2022-12-03 00:09:23 +02:00
Veikka Tuominen
59dad43de2 Sema: add error for failed assumption about struct having runtime bits 2022-12-02 18:46:59 +02:00
Veikka Tuominen
86e6acb37b AstGen: improve error message for missing parameter name
Closes #13393
2022-12-02 15:39:40 +02:00
Andrew Kelley
665eba93c1 CBE: eliminate zig_void
C void is perfectly fine.
2022-12-02 00:46:27 -05:00
Andrew Kelley
4071b22454
Merge pull request #13715 from Vexu/cbe
cbe bug fixes and improvements
2022-12-01 17:38:11 -05:00
Veikka Tuominen
6ded2d2adb cbe: disable failing behavior test on aarch64 2022-12-01 12:18:10 +02:00
Veikka Tuominen
d0edaabf9d Value: fix elemValueAdvanced for optional payloads
Closes #13707
2022-12-01 11:49:06 +02:00
Andrew Kelley
a943422672
Merge pull request #13717 from GethDW/option-fix
std.build.Builder: fix for Allocator changes
2022-11-30 19:43:51 -05:00
Andrew Kelley
b1793c2b52 add test coverage for zig build CLI and options API 2022-11-30 13:22:43 -07:00
Luuk de Gram
090deae41d
wasm: enable behavior tests for packed structs 2022-11-30 21:01:09 +01:00
Veikka Tuominen
11ec7109c3 cbe: do not memcpy identical integer types when bitcasting 2022-11-30 17:11:06 +02:00
Veikka Tuominen
15cc83e27a cbe: reduce amount of temporary locals 2022-11-30 17:11:06 +02:00
Veikka Tuominen
f4afeb3ffd AstGen: fix incorrect handling of source cursor with shift builtins
Closes #13714
2022-11-30 17:11:06 +02:00
Veikka Tuominen
2dcac348e5 cbe: implement packed unions 2022-11-30 15:14:33 +02:00
Veikka Tuominen
1a1a5702ab cbe: correctly handle pointers to zero bit error union payloads 2022-11-30 15:14:33 +02:00
Veikka Tuominen
4def9c4a9b cbe: operand of address of operator must be an lvalue 2022-11-30 15:14:33 +02:00
Veikka Tuominen
6310186d52 cbe: cast pointer switch target to int 2022-11-30 15:14:33 +02:00
Veikka Tuominen
8af5648015 Sema: make inferred allocs always mutable
Const allocs don't make any sense, make_ptr_const handles making
the pointers not mutable.
2022-11-30 15:14:33 +02:00
Veikka Tuominen
63ae7899ae cbe: ensure test and tagName function names are unique 2022-11-30 15:14:33 +02:00
Andrew Kelley
ceb0a632cf std.mem.Allocator: allow shrink to fail
closes #13535
2022-11-29 23:30:38 -07:00
Andrew Kelley
deda6b5146 LLVM: fix canElideLoad behavior with loops
closes #13546
2022-11-30 00:20:49 -05:00
Veikka Tuominen
b2b1d421c3 Sema: add missing failWithBadMemberAccess to zirExport
The assumption that AstGen would error only holds when exporting
a identifier not a namespace member.
2022-11-29 21:44:08 +02:00
Veikka Tuominen
4b0ef6a409 Sema: make non-existent field error point to field name
Closes #13698
2022-11-29 21:44:08 +02:00
Veikka Tuominen
6f5a438946 AstGen: unstack block scope when creating opaque type
Closes #13697
2022-11-29 21:44:08 +02:00
Veikka Tuominen
ed73429926 Sema: explain why parameter must be declared comptime
Closes #13692
2022-11-29 21:44:08 +02:00
Veikka Tuominen
17ff002bc0 Sema: improve safety panic for access of inactive union field 2022-11-29 21:44:08 +02:00
Veikka Tuominen
6337c04244 Sema: improve panic for slice start index being greater than end index
Closes #13689
2022-11-29 15:47:02 +02:00
Veikka Tuominen
6f9c7e33b9 llvm: implement union_init for packed unions
Closes #13664
2022-11-29 15:47:02 +02:00
Jakub Konka
1829b6eab8
Merge pull request #13625 from kcbanner/windows_disable_symlink_tests
Skip linker tests requiring symlinks on Windows
2022-11-29 02:57:37 +01:00
Jakub Konka
033aa1d761 aarch64-windows: skip failing standalone tests 2022-11-28 19:45:53 -05:00
Jakub Konka
870872dd63 aarch64-windows: skip failing floatop behavior test 2022-11-28 18:10:51 -05:00
Jakub Konka
07bf4de6a9 aarch64-windows: skip failing align behavior test 2022-11-28 18:10:51 -05:00
kcbanner
ea84eda904 'fmt' 2022-11-26 17:16:56 -05:00
Veikka Tuominen
304e828088
Merge pull request #13637 from Vexu/stage2-fixes
Stage2 bug fixes
2022-11-26 22:03:49 +02:00
kcbanner
57bc61ab26 test-link: add -Denable-symlinks-windows to opt-in to using symlinks
Adds a way for standalone tests to declare they need symlinks, and these
tests won't be run on windows unless -Denable-symlinks-windows is set
2022-11-26 14:26:26 -05:00
Veikka Tuominen
71937f75d8 Sema: correctly detect union target in zirSwitchBlock
Closes #13655
2022-11-26 18:05:27 +02:00
Veikka Tuominen
fe38898246 Sema: pass c_import_buf to child block in more places
Closes  #13651
2022-11-26 18:05:27 +02:00
Veikka Tuominen
587ef60a28 Sema: resolve union fields before using getTagType
Closes #13649
2022-11-26 18:05:27 +02:00
Veikka Tuominen
bf62cb453b Sema: handle anytype parameter requiring comptime
Closes #13645
2022-11-26 18:05:27 +02:00
Veikka Tuominen
72fa8d4880 Sema: fix overflow arithmetic with runtime vectors
It should return a a vector of bools for compatibility with scalar
operands and stage1 until #10248 can be implemented.

Closes #13201
2022-11-26 18:05:27 +02:00
Andrew Kelley
30eb2a1753
Merge pull request #13627 from Vexu/tuple-decls
Implement tuple type declarations
2022-11-25 18:06:09 -05:00
Veikka Tuominen
9f055e2eb0 Sema: improve compile error for tuple coercion mismatch 2022-11-23 22:16:31 +02:00
Veikka Tuominen
8eea73fb92 add tests for tuple declarations 2022-11-23 22:16:31 +02:00
Andrew Kelley
4ec27a4e25 C backend: implement vector reduce and overflow intrinsics 2022-11-22 23:33:58 -07:00
Veikka Tuominen
fc5209c139 llvm: fix x86_64 sysV ABI of big vectors on avx512 enabled CPUs
Closes #13629
2022-11-23 00:05:07 +02:00
Andrew Kelley
5e42378227 disable failing C ABI test
see tracking issue #13629
2022-11-22 13:06:09 -07:00
Cody Tapscott
3fa226a80c AstGen: Pop error trace for continue
PR #12837 handled control flow for break and return, but I forgot
about `continue`. This is effectively another break, so we just
need another `.restore_err_ret_index` ZIR instruction.

Resolves #13618.
2022-11-22 14:00:41 +02:00
Andrew Kelley
7829c73ccf disable failing arm-linux non-llvm backend tests
See #13623
2022-11-21 22:56:05 -07:00
Veikka Tuominen
d968d9d103 llvm: add attributes to the arguments of function pointer calls
Closes #13605
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e276d32f3 Sema: fix memory management of missing field error
Closes #13590
2022-11-20 20:25:12 +02:00
Veikka Tuominen
9e7293619f llvm: aarch64 C ABI: pass byref params as mutable pointers
Closes  #13597
2022-11-20 20:25:12 +02:00
Veikka Tuominen
08a00f0d1c llvm: use alignment of ABI return type when it differs from raw return type
This would previously cause miscompilations when the ABI type had
bigger alignment than the raw type.
2022-11-20 20:25:12 +02:00
Veikka Tuominen
835a1f7f0c Sema: fix missing error on mismatched array init count
Closes #13582
2022-11-20 20:25:12 +02:00
Veikka Tuominen
034507ef7c Module: fix compile error for non-comptime-known global initializer 2022-11-20 20:25:12 +02:00
Veikka Tuominen
98b3734b67 Sema: prioritize Value.variable over OPV when resolving const value
Closes #12275
2022-11-20 20:25:12 +02:00
Veikka Tuominen
bc76873827 Sema: fix type check in zirIntToPtr
Simple fix: don't assume a ptr type before it has been checked.

Closes #13567
2022-11-20 20:25:11 +02:00
Veikka Tuominen
510b891d27 Sema: handle opt_payload in beginComptimePtrLoad 2022-11-20 20:25:11 +02:00
Veikka Tuominen
0616d2966a Sema: allow coercing typed undefined to int
Closes #13556
2022-11-20 20:25:11 +02:00
Veikka Tuominen
44f8714dfb translate-c: cast unsuffixed floats to f64 2022-11-20 16:10:54 +02:00
Guillaume Wenzek
476b946802
compute LLVMTypes in ParamTypeIterator (#13592)
follow up on #13376 - fixes a bug in the x86_64 C ABI. 

Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-11-20 01:14:02 -08:00
Andrew Kelley
0697883d01 extract C backend behavior tests with vectors
No functional change. Separates various float operations behavior tests
from the ones that test vectors.
2022-11-19 01:29:51 -05:00
kkHAIKE
ea590ece4b
Sema: optimize compare comptime float with int 2022-11-18 22:06:49 +02:00
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Veikka Tuominen
8082323dfd
Merge pull request #13411 from dweiller/custom-test-runner
Custom test runner
2022-11-18 14:47:21 +02:00
Guillaume Wenzek
5221c90164
add C ABI tests with double
const DC = extern struct { v1: f64, v2: u8 };
const CFF = extern struct { v1: u8, v2: f32, v3: f32 };
const PD = extern struct { v1: ?*anyopaque, v2: f64 };

Signed-off-by: Guillaume Wenzek <gwenzek@users.noreply.github.com>
2022-11-18 14:05:25 +02:00
Veikka Tuominen
28cbe5e92a Sema+llvm: improve handling of namespace-like unions
Closes #13557
2022-11-16 01:13:35 +02:00
Veikka Tuominen
fe6249348f Sema: ensure comptime reference to function points to original decl
This prevents sema from creating new decls for the functions and
passing them to the backends as non-function decls.

Closes #12501
2022-11-16 01:12:54 +02:00
Veikka Tuominen
2cfa7165e7 Sema: do not re-evaluate type of non-generic inline call parameters
Closes #13491
2022-11-16 01:12:27 +02:00
mparadinha
c4f7663c92
Fix error reporting the wrong line for struct field inits (#13502)
* point to init part of field delc when that's where the error occurs

* update test to reflect fixed error message

* only lookup source location in case of error
2022-11-15 15:17:23 +02:00
Andrew Kelley
a50ad04e85 disable failing test on aarch64-macos 2022-11-14 16:07:52 -07:00
Veikka Tuominen
87cf2783eb llvm: check that tuple fields have runtime bits
Just checking that they aren't comptime isn't enough for `@Type` constructed tuples.

Closes #13531
2022-11-12 15:41:29 +02:00
Veikka Tuominen
a760ce598c Sema: ensure that !is_comptime and !is_typeof implies sema.func != null
Closes #13481
2022-11-12 15:41:29 +02:00
Veikka Tuominen
d42f4abb9d llvm: correctly lower references to generic functions
Closes #13522
2022-11-12 15:41:29 +02:00
Veikka Tuominen
40a2dfc12a Sema: coerce array operands to shuffle
Closes #13494
2022-11-11 18:00:05 +02:00
Veikka Tuominen
9b832e7f53 Sema: make check for namespace lookup of private declarations more strict
Previously sema only checked that the private declaration was in the same
file as the lookup but now it also checks that the namespace where
the decl was included from was also in the same file.

Closes #13077
2022-11-11 17:59:53 +02:00
Veikka Tuominen
0a188190b3 AstGen: make pointless discard error more strict
The error should only happen as a result of `_ = <expr>` not
for an operand of a break expression that is discarded.

Closes #13212
2022-11-11 17:59:53 +02:00
Veikka Tuominen
d2cc55109a llvm: correct calculation of index of zero-bit field
If the field comes before any non-zero-bit field then the index of
the next field should be returned.

Closes #13363
2022-11-11 17:59:53 +02:00
Veikka Tuominen
c4465556fd Type: check return_type for generic poison before comparing
Closes #13423
2022-11-11 17:59:53 +02:00
Veikka Tuominen
89e8bb409a AstGen: use condbr_inline if force_comptime is set
The `finishThenElseBlock` would correctly use `break_inline`
which would cause Sema to use `addRuntimeBreak` instead of
doing the branch at comptime.
2022-11-11 17:59:53 +02:00
Cody Tapscott
2897641fb9 stage2: Support modifiers in inline asm
These are supported using %[ident:mod] syntax. This allows requesting,
e.g., the "w" (32-bit) vs. "x" (64-bit) views of AArch64 registers.

See https://llvm.org/docs/LangRef.html#asm-template-argument-modifiers
2022-11-11 16:01:31 +02:00
Cody Tapscott
b1357091ae Add test case for #12043
This bug is already resolved, just want to make sure we don't lose
the test case. Closes #12043
2022-11-10 12:23:59 -07:00
Cody Tapscott
fbda15632d stage2 sema: Make vector constants when operating on vectors
Resolves https://github.com/ziglang/zig/issues/13058
2022-11-10 12:22:40 -07:00
Cody Tapscott
8f3880074f stage2: Be more strict about eliding loads
This change makes any of the `*_val` instructions check whether it's
safe to elide copies for by-ref types rather than performing this
elision blindly.

AIR instructions fixed:
 - .array_elem_val
 - .struct_field_val
 - .unwrap_errunion_payload
 - .try
 - .optional_payload

These now all respect value semantics, as expected.

P.S. Thanks to Andrew for the new way to approach this. Many of the
lines here are from his recommended change, which comes with the
significant advantage that loads are now as small as the intervening
memory access allows.

Co-authored by: Andrew Kelley <andrew@ziglang.org>
2022-11-10 12:22:40 -07:00
Cody Tapscott
ff699722da stage2: Fix comptime array initialization
This is a follow-up to 9dc98fba, which made comptime initialization
patterns for union/struct more robust, especially when storing to
comptime-known pointers (and globals).

Resolves #13063.
2022-11-10 12:22:37 -07:00
Jakub Konka
04b8ce5fd3 Merge branch 'jcmoyer-lld-explicit-pdb' 2022-11-10 16:52:43 +01:00
Jakub Konka
4b3637820d
Merge pull request #13495 from ziglang/macho-dsym
stage2: misc DWARF debug info fixes and additions for x86_64 and aarch64
2022-11-10 16:50:57 +01:00
Jakub Konka
1357790ec9 win: combine PDB fixes into one changeset 2022-11-10 14:03:11 +01:00
Jakub Konka
0914e0a4ec dwarf: do not assume unsigned 64bit integer for the enum value 2022-11-10 09:36:45 +01:00
Jakub Konka
2d5fbbb44e
Merge pull request #13485 from ziglang/arm64-non-null-actual
aarch64: optionals
2022-11-09 21:13:50 +01:00
Veikka Tuominen
61842da9f7 llvm: implement packed unions
Closes #13340
2022-11-09 17:14:38 +02:00
Jakub Konka
e83590d0e8 aarch64: pass some tests dealing with optionals 2022-11-08 13:59:47 +01:00
Veikka Tuominen
dc128f403b
Merge pull request #13446 from Vexu/stage2-fixes
Stage2 bug fixes
2022-11-07 14:17:26 +02:00
Jakub Konka
72769f6cec link-tests: add test case for parsing weak imports 2022-11-06 15:21:28 +01:00
Jakub Konka
5ef33e7c7e
Merge pull request #13459 from ziglang/issue-13457
macho: do not zero-out file if there are no nonzerofill sects
2022-11-06 08:39:13 +01:00
Jakub Konka
aaaa7df152 macho: add linker test case for issue 13457 2022-11-06 00:10:12 +01:00
Veikka Tuominen
5d28d171df Sema: adjust result type of anyerror field access
Closes #13448
2022-11-05 13:22:21 +02:00
Veikka Tuominen
ea48f06fc2 stage2: address of threadlocal variable is not comptime known
Closes #13215
2022-11-05 13:22:21 +02:00
Veikka Tuominen
f96748ebc1 Sema: coerce elements of array cat
Closes #13347
2022-11-05 13:22:21 +02:00
Veikka Tuominen
f92e7bed7b stage2: bitsize of packed struct should trigger backing int ty check
Closes #13398
2022-11-05 12:54:38 +02:00
Andrew Kelley
1d68045919
Merge pull request #13101 from alichraghi/o4 2022-11-05 02:34:24 -04:00
Veikka Tuominen
51b1083d66 stage2: fix onePossibleValue of empty unions and enums
Closes #13402
2022-11-04 23:13:50 +02:00
Veikka Tuominen
42db468dcb Sema: make method call work with optionals and error unions
Closes #13414
2022-11-04 23:13:49 +02:00
Veikka Tuominen
35afa3fd8b Sema: correct condition in validateArrayInit
Closes #13425
2022-11-04 23:13:49 +02:00
Veikka Tuominen
799a558e39 Sema: implement peer type resolution of function pointers and function bodies
Closes  #13438
2022-11-04 23:13:49 +02:00
Veikka Tuominen
e6b3cb5043 Sema: detect division overflow
Closes #13434
2022-11-04 23:13:29 +02:00
Veikka Tuominen
8c4faa5f3f
Merge pull request #13338 from Vexu/stage2-compile-errors
Improve some error messages
2022-11-04 16:04:31 +02:00
Micah Switzer
ea54c9a375 Sema: resolve lazy align in zirReify for union fields
Closes #13435
2022-11-04 15:48:08 +02:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Nathan Bourgeois
e64eef366c
Translate-C Remainder Macro Fix 2022-11-03 14:07:00 +02:00
Jacob Young
4537c1b8b6 cbe: fix crash rendering union with zero-bit tag 2022-11-02 21:42:40 -04:00
Jacob Young
fa46f9a3d7 cbe: fix extern 2022-11-02 21:42:40 -04:00
Andrew Kelley
e50789f1cb
Merge pull request #13389 from jacobly0/fix-only-c
cbe: enough fixes for `-Donly-c` to be able to produce an executable
2022-11-02 15:53:59 -04:00
Andrew Kelley
57dbeb90af
Merge pull request #13396 from Luukdegram/fix-12880
llvm: mangle extern function names for Wasm target
2022-11-02 14:10:07 -04:00
Jacob Young
37c104ade0 cbe: ignore comptime fields when generating tuple typedefs
This vastly reduces the amount of deduplication state we need to deal with.
2022-11-02 10:21:05 -04:00
Jacob Young
5f31070b8b cbe: hack around invalid Air
Can be changed to `!inst_ty.hisRuntimeBitsIgnoreComptime()` when the
"result location with inferred type ends up being pointer to comptime_int"
test stops producing Air containing a `bitcast(*comptime_int, ...)`.

See #13410
2022-11-02 10:20:31 -04:00
dweiller
ae0f12885b test: add test_runner_path test 2022-11-02 22:41:20 +11:00
Jacob Young
09763435a8 cbe: support arrays in more places 2022-11-01 20:39:06 -04:00
Jacob Young
071404ff65 cbe: fix optional access 2022-11-01 20:39:05 -04:00
Jacob Young
91fe0b80a2 cbe: fix threadlocal 2022-11-01 20:38:51 -04:00
Jacob Young
757db665a7 build: remove ofmt from LibExeObjStep which is redundant with target.ofmt 2022-11-01 20:38:37 -04:00
joachimschmidt557
3ecec50f0c
stage2 AArch64: implement basic switch statements 2022-11-01 20:43:27 +01:00
Luuk de Gram
ef0df24626
test/link: add linker test to verify mangling
This adds a simple linker test to ensure the built library contains
an import entry for each extern function call that was mangled.
2022-11-01 15:43:34 +01:00
Jacob Young
b35514ecfe cbe: disable aarch64 behavior tests that are broken with gcc 2022-10-31 21:01:04 -04:00
Jacob Young
b945d3eb90 cbe: improve support for non-native float types
* Fix _start on aarch64.
 * Add fallbacks when a float type is unsupported.

Fixes #13357
2022-10-31 20:18:15 -04:00
Andrew Kelley
ef761c2cbc
Merge pull request #13360 from topolarity/comptime-bool-binops
Make `x and false` and `x or true` comptime-known
2022-10-30 22:11:44 -04:00
Jacob Young
a77d89afe3 behavior: enable fixed cbe tests 2022-10-30 15:38:50 -04:00
Cody Tapscott
ca332f57f7 stage2: Make x and false/x or true comptime-known
Same as preceding change, but for stage2.
2022-10-30 12:38:08 -07:00
Andrew Kelley
17df35025b CI: disable failing C backend test
See #13357
2022-10-30 03:21:18 -07:00
Andrew Kelley
5f5a20ebaf
Merge pull request #13093 from jacobly0/backend-fixes
C backend fixes
2022-10-29 23:06:59 -04:00
Andrew Kelley
28dc208f65
Merge pull request #13082 from g-w1/unnamed-decls-and-relocs-p9
Plan9: Fix The Backend
2022-10-29 17:45:00 -04:00
Veikka Tuominen
d7314555f2 Sema: improve compile error for casting double pointer to anyopaque pointer
Closes #12042
2022-10-29 14:55:43 +03:00
Veikka Tuominen
1ea1228036 Sema: fix floatToInt to zero bit ints
Closes #9415
2022-10-29 14:55:43 +03:00
Veikka Tuominen
61f5ea4c9a Sema: add error note for wrong pointer dereference syntax
Closes #1897
2022-10-29 14:55:43 +03:00
Jacob Young
48a2783969 cbe: implement optional slice representation change 2022-10-29 05:58:41 -04:00
Andrew Kelley
c36eb4ede9
Merge pull request #13221 from topolarity/packed-mem
Introduce `std.mem.readPackedInt` and improve bitcasting of packed memory layouts
2022-10-28 21:15:16 -04:00
Evan Haas
c616141241 translate-c: Better support for division in macros
Perform C-style arithmetic conversions on operands to division operator
in macros

Closes #13162
2022-10-28 17:59:32 -04:00
Cody Tapscott
40b7792a4c Enable bitcast test now that #13214 is resolved. 2022-10-28 12:41:15 -07:00
Cody Tapscott
3295fee911 stage2: Use mem.readPackedInt etc. for packed bitcasts
Packed memory has a well-defined layout that doesn't require
conversion from an integer to read from. Let's use it :-)

This change means that for bitcasting to/from a packed value that
is N layers deep, we no longer have to create N temporary big-ints
and perform N copies.

Other miscellaneous improvements:
  - Adds support for casting to packed enums and vectors
  - Fixes bitcasting to/from vectors outside of a packed struct
  - Adds a fast path for bitcasting <= u/i64
  - Fixes bug when bitcasting f80 which would clear following fields

This also changes the bitcast memory layout of exotic integers on
big-endian systems to match what's empirically observed on our targets.
Technically, this layout is not guaranteed by LLVM so we should probably
ban bitcasts that reveal these padding bits, but for now this is an
improvement.
2022-10-28 08:41:04 -07:00
Veikka Tuominen
6fc71835c3 value: properly hash null_value pointer
Closes #13325
2022-10-28 13:31:16 +03:00
Veikka Tuominen
c3b85e4e2f Sema: further enhance explanation of why expr is evaluated at comptime 2022-10-28 13:31:16 +03:00
Andrew Kelley
c389f8800b
Merge pull request #13290 from Vexu/generic-deletion-mitigation
Mitigate generic deletion bug
2022-10-28 01:04:00 -04:00
Andrew Kelley
2991e4a454
Merge pull request #13288 from Vexu/opt-slice
Optimize size of optional slices (+ some fixes)
2022-10-27 22:09:17 -04:00
InKryption
bc72ae5e4e Sema: Prevent coercion from tuple pointer to mutable slice.
Also fix some stdlib code affected by this.

Co-authored by: topolarity <topolarity@tapscott.me>
2022-10-27 22:00:47 -04:00
Veikka Tuominen
d03c47bf85 Sema: use runtime_value instead of creating allocs 2022-10-27 21:08:25 -04:00
Veikka Tuominen
648d34d8ea Sema: coerce zero-bit generic args are coerced properly
Closes #13307
2022-10-27 13:40:20 +03:00
Veikka Tuominen
b937a04560 Sema: check coerceInMemoryAllowed earlier in resolvePeerTypes
Closes #13310
2022-10-27 01:31:18 +03:00
Veikka Tuominen
d9fe5ba7f8 Sema: add error for too big packed struct 2022-10-27 01:31:18 +03:00
Veikka Tuominen
4ac8ec4c5c AstGen: fix refing inferred allocs
Closes  #13285
2022-10-27 01:31:18 +03:00
Veikka Tuominen
4fc944dde8 translate-c: fix redefinition of label on left recursive comma operator
Closes #13239
2022-10-27 01:31:18 +03:00
Veikka Tuominen
78a7bb108a llvm: handle namespace like packed structs
Closes #13159
Closes #13188
2022-10-27 01:31:18 +03:00