Andrew Kelley
54eb0f2daa
Merge pull request #13032 from jacobly0/br-on-undef-val
...
stage2: fix branches on undefined values
2022-10-03 22:46:22 -04:00
Jacob Young
38bd2bbcf2
stage2: fix C ABI for bool
...
This fixes a miscompilation compiling debug zig with release stage3 zig.
2022-10-03 22:41:07 -04:00
Jacob Young
9d8cdb855b
Sema: fix function paramater count mismatch note
...
expected type 'fn() void', found 'fn(i32) void'
function with 0 parameters cannot cast into a function with 0 parameters
=>
expected type 'fn() void', found 'fn(i32) void'
function with 1 parameters cannot cast into a function with 0 parameters
2022-10-03 13:06:49 +03:00
Julian
32d755beb8
Sema: require reified packed struct fields to have zero alignment
2022-10-03 13:05:12 +03:00
Jacob Young
272e31227c
llvm: add assert to reliably catch undefined value use
...
This assert makes it possible to detect a regression of #13030 in the
future without relying on undefined value tracking.
2022-10-01 09:03:28 -04:00
Jacob Young
b7bd44a654
Sema: ensure builtin.StackTrace fields are analyzed
...
When encountering a fn type that returns an error (union), a backend
that supports error return tracing will want the StackTrace struct and
its fields to be analyzed.
2022-10-01 08:09:43 -04:00
Jacob Young
8b66443d50
llvm: avoid undefined values by ensuring the StackTrace decl is analyzed
...
The test builds an object file to prevent StackTrace from already having
been analyzed by other code.
Fixes #13030
2022-10-01 04:02:09 -04:00
Jacob Young
d9490a4340
Sema: avoid undefined fields in file struct decls
...
Fixes original comment of #12399
2022-10-01 04:02:00 -04:00
Veikka Tuominen
2a4e89e0c9
Type: correctly handle ABI align strat for optionals and error unions
...
Closes #12984
2022-09-30 00:46:45 +03:00
Veikka Tuominen
3122601242
AstGen: do not set decl_line for containers
...
Previously AstGen would set decl_line for containers so that
declarations inside them would be relative to the start of the
container but Sema was not aware of the line offset of the container
and would make them relative to the containers parent decl which
would then break for generic structs.
In the future when working on incremental compilation it will likely
be better to communicate the line delta to Sema but for now this
is a simpler fix that correctly handles the non-incremental case.
Closes #12725
Closes #12818
2022-09-30 00:09:24 +03:00
Veikka Tuominen
b3c6d774d2
stage2: improve error message for missing member in file root struct
...
* the root struct decl name is fully qualified
this prevents error messages containing 'main.main'
* avoid declared here note when file struct is missing a member
It always points at the start of the file which might contain another
container misleading the user.
2022-09-30 00:09:24 +03:00
Veikka Tuominen
409cf4aeb8
Sema: use correct ptr ty to check for attributes of slice field ptr
...
Closes #12870
Closes #13006
2022-09-30 00:09:24 +03:00
Igor Anić
9f6f460124
Sema: improve source location in errors
...
resolves #12793
2022-09-29 14:45:08 +03:00
kkHAIKE
317cb629fb
Sema: fix resolveInferredErrorSet panic when generic inline function
2022-09-29 14:44:37 +03:00
Jacob G-W
0a064eae99
stage2: detect duplicate enum values
...
Closes #12805
2022-09-28 12:48:54 +03:00
Cody Tapscott
e165b8b223
stage2: Fix multiple_llvm_int parameter passing
...
Small iteration oopsie
We could really use some more comprehensive C ABI tests.
2022-09-28 12:48:28 +03:00
InKryption
c75e8f3616
Sema: check that reified enum field values fits tag type.
2022-09-27 18:38:37 +03:00
Veikka Tuominen
c673e6a48a
Sema: avoid passing .unneeded to safetyPanic
2022-09-27 18:35:32 +03:00
Jacob Young
c1493635fb
fmt: ignore non-files
2022-09-27 13:25:19 +03:00
kkHAIKE
ba5cbea0c3
Sema: fix segfault when union init with empty field
2022-09-27 13:23:51 +03:00
Jakub Konka
9c2fb6e186
Merge pull request #12959 from kcbanner/fix_uwtable
...
llvm: fix missing unwind info (wrong uwtable attribute value)
2022-09-26 23:05:39 +02:00
Luuk de Gram
9cd521a24f
zig fmt
2022-09-26 19:54:35 +02:00
Der Teufel
55a9db4c9d
autodoc: Added .html to generated source view file names
2022-09-26 15:46:01 +02:00
John Schmidt
b6bda5183e
sema: load the correct AST in failWithInvalidComptimeFieldStore
...
The container we want to get the fields from might not be declared in the
same file as the block we are analyzing, so we should get the AST from
the decl's file instead.
2022-09-26 08:56:34 +02:00
John Schmidt
6cc2b26163
sema: load the correct AST in addFieldErrNote
...
The enum we want to get the fields from might not be declared in the
same file as the block we are analyzing, so we should get the AST from
the decl's file instead.
Closes #12950 .
2022-09-25 10:28:48 +02:00
kcbanner
1cc890e5c3
llvm: update uwtable value for stage1
2022-09-25 02:39:00 -04:00
kcbanner
328f75c985
llvm: fix uwtable attribute value
2022-09-25 01:52:40 -04:00
Veikka Tuominen
c4400e8aa5
AstGen: reset anon_name_strategy for sub expressions
...
Closes #12910
2022-09-24 16:30:37 +03:00
Veikka Tuominen
8e4d0ae4f5
Sema: avoid generic parameter error in nested function type
...
Related to cd1833044ab7505bc101c85f59889bd3ea3fac80
Closes #12945
2022-09-24 15:15:36 +03:00
Veikka Tuominen
3a5148112d
Sema: avoid using pointerDecl when dealing with slices
...
Closes #12885
2022-09-24 14:43:03 +03:00
Veikka Tuominen
fdf4c875ff
llvm: avoid crash on duplicate asm input/output name
2022-09-24 14:43:03 +03:00
Veikka Tuominen
3525b8778e
Sema: properly handle generic struct as parameter type
...
Closes #12907
2022-09-24 14:43:03 +03:00
Veikka Tuominen
ede3798485
Sema: resolve struct layout in zirStructInit
...
Closes #12911
2022-09-23 17:39:21 +03:00
Veikka Tuominen
581df942e1
Sema: correct sentinel check on implicit cast from array ptr
...
Closes #12938
2022-09-23 17:39:06 +03:00
Veikka Tuominen
3de5c3b503
Sema: check for slices in packed and extern type validation
...
Closes #12930
2022-09-23 17:39:06 +03:00
Veikka Tuominen
8d1fdfc8ed
Sema: preserve volatileness when constructing field pointers
...
Closes #12928
2022-09-23 17:39:06 +03:00
Andrew Kelley
99b954b9ce
LLVM: remove purposeless const qualifiers
...
These const qualifiers on pointers to opaque types do not serve any
purpose. If anything they are misleading since the underlying pointers
very likely point to objects that are in fact mutated.
This commit does not change any behavior.
2022-09-21 13:27:23 -07:00
kkHAIKE
4961044ce8
AstGen: store void to ptr result loc when there is no else branch
2022-09-21 20:21:02 +03:00
kkHAIKE
183127733c
AstGen: make loop body's ResultLoc .none
...
Fixes #12555
Fixes #12551
Fixes #12455
2022-09-21 20:20:05 +03:00
Jacob Young
14f4c73191
sema: fix typo
2022-09-21 11:29:20 +02:00
Andrew Kelley
85e3204344
stage2: free up 2 ZIR tags
...
cmpxchg_weak and cmpxchg_strong are not very common; demote them to
extended operations to make some headroom.
This commit does not change any behavior, only memory layout of the
compiler.
2022-09-21 03:54:37 -04:00
Veikka Tuominen
694fab4848
std: add return address parameter to panic fn
2022-09-20 19:05:00 -07:00
Veikka Tuominen
8f2e82dbf6
safety: show error return trace when unwrapping error in switch
2022-09-20 19:05:00 -07:00
Andrew Kelley
62ecc154d9
Merge pull request #12904 from Vexu/ptrcast
...
stage2: pointer casting fixes and improvements
2022-09-20 22:02:36 -04:00
joachimschmidt557
f014de6456
stage2 ARM: fix debug info for arguments passed in registers
2022-09-20 17:14:31 +02:00
joachimschmidt557
258b058eec
stage2 ARM: make sub_sp_scratch MIR instruction use r4
...
r0 is used for argument passing, so this register is not available as
a scratch register upon function entry.
2022-09-20 17:14:27 +02:00
Veikka Tuominen
eef6539049
Sema: handle Value.slice in beginComptimePtrLoad
2022-09-20 00:50:13 +03:00
Veikka Tuominen
3e80aa9079
Sema: validate @alignOf type
2022-09-20 00:50:13 +03:00
Veikka Tuominen
540130650f
Sema: pass calculated offset to elemPtrType in elemPtrSlice
2022-09-20 00:50:13 +03:00
Veikka Tuominen
541b3e3a31
Sema: check pointer qualifiers before implicit cast
...
Closes #12881
2022-09-20 00:50:13 +03:00