21102 Commits

Author SHA1 Message Date
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
fb09093d95 Module: call ensureDeclAnalyzed on builtin.test_functions
Previously the compiler would crash on branching on undefined values
if you tried using `zig test` with a freestanding target since there
was no start code referencing `builtin.test_functions`.

Closes #12554
2022-11-16 01:12:28 +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
Veikka Tuominen
b6b3462796 std.mem.Allocator: do not return undefined pointers from create
Closes #13517
2022-11-16 01:12:27 +02:00
Veikka Tuominen
11c64bfe6e llvm: implement arbitrary precision debug enumerators
Closes #645
2022-11-16 01:12:27 +02:00
GethDW
024bac7f53 std.build: fix typo
This would only fail to compile when building *on* WASI.
2022-11-15 23:23: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
Hayden Pope
ceb9fedb47 std.os.linux: Add setitimer and getitimer syscalls 2022-11-15 02:38:28 -05:00
Andrew Kelley
14986077ce CI: disable github workflows until it is working in the ci branch 2022-11-14 17:40:44 -07:00
Andrew Kelley
a50ad04e85 disable failing test on aarch64-macos 2022-11-14 16:07:52 -07:00
Andrew Kelley
5d7efa6d82 CI: aarch64-linux: init 2022-11-14 16:04:01 -07:00
Andrew Kelley
e14d135881 macos: x86_64: fix wrong path to cmake 2022-11-14 15:17:41 -07:00
Andrew Kelley
27e63bb59f CI: aarch64-macos: set PATH env var for cmake 2022-11-14 15:15:12 -07:00
Andrew Kelley
37402e4d17 CI: separate aarch64 and x86_64 macos scripts 2022-11-14 15:10:05 -07:00
Loris Cro
bbd0775d77 ci: init github actions support 2022-11-14 22:41:36 +01:00
Frank Denis
7eed028f9a
crypto.bcrypt: fix massive speed regression when using stage2 (#13518)
state: State -> state: *const State
Suggested by @nektro

Fixes #13510
2022-11-14 16:37:19 +01:00
Motiejus Jakštys
d823680e18
musl.zig: remove unused enum (#13545) 2022-11-14 16:35:25 +01:00
Naoki MATSUMOTO
b29057b6ab
std.crypto.ghash: fix uninitialized polynomial use (#13527)
In the process of 'remaining blocks',
the length of processed message can be from 1 to 79.
The value of 'n-1' is ranged from 0 to 3.
So, st.hx[i] must be initialized at least from st.hx[0] to st.hx[3]
2022-11-14 16:35:08 +01:00
Andrew Kelley
0b0292c456
Merge pull request #13536 from ziglang/cbe-zig-h
C backend: improve ergonomics of zig.h a little bit
2022-11-14 01:53:14 -05:00
Andrew Kelley
20e8c2df4e zig.h: remove redundant definition of u16/i16 2022-11-13 16:50:20 -07:00
Andrew Kelley
77e7d97725 C backend: improve ergonomics of zig.h a little bit
Partially implements #13528. Enough to unblock the wasi-bootstrap
branch.
2022-11-13 16:50:16 -07:00
Veikka Tuominen
0184c8d86f Sema: remove block and src parameters from getBuiltin
These parameters are only ever needed when `std.builtin` is out of sync
with the compiler in which case panicking is the only valid operation
anyways. Removing them causes a domino effect of functions no longer
needing a `src` and/or a `block` parameter resulting in handling
compilation errors where they are actually meaningful becoming simpler.
2022-11-13 15:45:25 -05:00
Halil
b2ffe113d3
x/os/Reactor: implement remove function (#13330)
* x/os/Reactor: implement remove function

* x/os/Reactor: update tests
2022-11-13 17:43:29 +02:00
Jonathan
81dadbcd77 pthread_sigmask 2022-11-13 17:36:56 +02:00
Veikka Tuominen
99616216c3
Merge pull request #13497 from Vexu/stage2-fixes
Stage2 bug fixes
2022-11-13 17:35:57 +02:00
Nick Cernis
8a5818535b
Make invalidFmtError public and use in place of compileErrors for bad format strings (#13526)
* Export invalidFmtErr

To allow consistent use of "invalid format string" compile error
response for badly formatted format strings.

See https://github.com/ziglang/zig/pull/13489#issuecomment-1311759340.

* Replace format compile errors with invalidFmtErr

- Provides more consistent compile errors.
- Gives user info about the type of the badly formated value.

* Rename invalidFmtErr as invalidFmtError

For consistency. Zig seems to use “Error” more often than “Err”.

* std: add invalid format string checks to remaining custom formatters

* pass reference-trace to comp when building build file; fix checkobjectstep
2022-11-12 21:03:24 +02:00
Stevie Hryciw
32b97df50e langref: add appendix and explain 'container' terminology 2022-11-12 15:42:29 +02:00
IntegratedQuantum
fbc4331f18 Implements std.math.sign for float vectors. 2022-11-12 15:41:55 +02: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
Jakub Konka
7733246d6e pdb: make SuperBlock def public 2022-11-12 09:40:40 +01:00
Frank Denis
df7223c7f2 crypto.AesGcm: provision ghash for the final block 2022-11-11 18:04:22 +01:00
Veikka Tuominen
4f285d4dac GitHub: add issue template for error messages 2022-11-11 18:15:13 +02:00
Veikka Tuominen
e01ec96288 Autodoc: not all block_inlines contain a break_inline 2022-11-11 18:01:14 +02:00
Veikka Tuominen
52b8efc726 Sema: check for error unwrap in condbr_inline
The part of `condbr` that is supposed to be the same as `condbr_inline`
already does this.
2022-11-11 18:01:14 +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
25c8506421 AstGen: emit dbg_stmt before (nearly) all operations that have a safety check
All implicit casts can also potentially lead to a panic being emitted
but adding a dbg_stmt before every instruction is not feasible.

This adds 24k new instructions to the ZIR for Sema.zig increasing its
size from 3.8MiB to 4.0MiB.

Closes #13488
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
cacfb0cfe4 llvm: fix leaks of fully qualified names 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
b605cb2742 cmake: Mark <root>/.git/HEAD as a configure dependency
This ensures that the Zig version will be re-computed when jumping
through the source tree, which is especially important if bisecting
across AstGen- or other changes that must not use the old cache.
2022-11-10 19:34:56 -05:00
Andrew Kelley
892fb0fc88
Merge pull request #13074 from topolarity/stage2-opt
stage2: Miscellaneous fixes to vector arithmetic and copy elision
2022-11-10 19:34:43 -05:00
Jacob Young
e40c38d258 Sema: avoid breaking hash contract when instantiating generic functions
* Add tagName to Value which behaves like @tagName.
 * Add hashUncoerced to Value as an alternative to hash when we want to
   produce the same hash for value that can coerce to each other.
 * Hash owner_decl instead of module_fn in Sema.instantiateGenericCall
   since Module.Decl.Index is not affected by ASLR like *Module.Fn was,
   and also because GenericCallAdapter.eql was already doing this.
 * Use Value.hashUncoerced in Sema.instantiateGenericCall because
   GenericCallAdapter.eql uses Value.eqlAdvanced to compare args, which
   ignores coersions.
 * Add revealed missing cases to Value.eqlAdvanced.

Without these changes, we were breaking the hash contract for
monomorphed_funcs, and were generating different hashes for values that
compared equal.  This resulted in a 0.2% chance when compiling
self-hosted of producing a different output, which depended on
fingerprint collisions of hashes that were affected by ASLR.  Normally,
the different hashes would have resulted in equal checks being skipped,
but in the case of a fingerprint collision, the truth would be revealed
and the compiler's behavior would diverge.
2022-11-10 14:35:57 -05:00
Cody Tapscott
7b978bf1e0 stage2: Rename Value.compare to compareAll, etc.
These functions have a very error-prone API. They are essentially
`all(cmp(op, ...))` but that's not reflected in the name.

This renames these functions to `compareAllAgainstZero...` etc.
for clarity and fixes >20 locations where the predicate was
incorrect.

In the future, the scalar `compare` should probably be split off
from the vector comparison. Rank-polymorphic programming is great,
but a proper implementation in Zig would decouple comparison and
reduction, which then needs a way to fuse ops at comptime.
2022-11-10 12:24:02 -07: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