Commit Graph

4654 Commits

Author SHA1 Message Date
Anton Lilja 86d9c3de2b Sema: fix infinite recursion in explainWhyTypeIsComptime
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-06 14:17:09 +03:00
Andrew Kelley 5c9826630d Sema: elide safety of modulus and remainder division sometimes
Piggybacking on 40f8f0134f, remainder
division, modulus, and `%` syntax no longer emit safety checks for a
comptime-known denominator.
2022-08-05 21:13:18 -07:00
Meredith Oleander fd3415ad5e translate-c: fix alignment in pointer casts 2022-08-05 15:38:48 +03:00
Loris Cro 259f407160 init-exe template: align cli tests to new template 2022-08-05 00:42:53 +02:00
Veikka Tuominen 4ab60dc18b Sema: add error for dependency loops 2022-08-03 17:10:39 +03:00
Veikka Tuominen b79929b2ea AstGen: better source location for if/while condition unwrapping 2022-08-03 16:45:33 +03:00
Veikka Tuominen d1d24b426d AstGen: check loop bodies and else branches for unused result 2022-08-03 16:45:33 +03:00
Veikka Tuominen aa78ebaf95 Sema: improve circular dependency errors 2022-08-03 16:45:33 +03:00
Veikka Tuominen 02112f8836 AstGen: add error for break/continue out of defer expression 2022-08-03 16:45:33 +03:00
Veikka Tuominen 6547c3887e Sema: add error for closure capture at runtime 2022-08-03 16:45:33 +03:00
Veikka Tuominen 14f0b70570 Sema: add safety for sentinel slice 2022-08-02 18:34:30 +03:00
Veikka Tuominen 292906fb23 Sema: fix reify Fn alignment and args 2022-08-02 18:33:03 +03:00
Veikka Tuominen e47706f344 Sema: validate packed struct field types 2022-08-01 23:59:40 +03:00
Veikka Tuominen f1768b40b2 stage2: better source location for var decls 2022-08-01 23:37:01 +03:00
Veikka Tuominen 57f9405a8f Sema: validate bitcast operand type 2022-08-01 23:37:01 +03:00
Andrew Kelley 1ab15b6c9c Merge pull request #12289 from Vexu/stage2
Stage2: reify functions + fixes
2022-07-31 12:57:53 -07:00
Evan Haas 8632e4fc7b translate-c: use correct number of initializers for vectors
Fixes #12264
2022-07-30 13:24:03 +03:00
Veikka Tuominen 02dc073260 Sema: check comptime slice sentinel 2022-07-30 11:07:37 +03:00
Veikka Tuominen 4758752e5d Sema: implement coercion from tuples to tuples
Closes #12242
2022-07-30 00:18:08 +03:00
Veikka Tuominen 17622b9db1 Sema: implement @Type for functions
Closes #12280
2022-07-30 00:18:08 +03:00
Veikka Tuominen f43ea43ac9 stage2: fix hashing of struct values
Closes #12279
2022-07-30 00:17:49 +03:00
Andrew Kelley 1b1c70ce38 disable failing incremental compilation test case
see #12288

now `zig build test-cases -Denable-llvm` passes locally for me.
2022-07-29 02:35:06 -07:00
Andrew Kelley daac39364a fix compile error test case note column number 2022-07-29 02:35:06 -07:00
Veikka Tuominen fdaf9c40d6 stage2: handle tuple init edge cases 2022-07-29 10:12:36 +03:00
Veikka Tuominen 9e0a930ce3 stage2: add error for comptime control flow in runtime block 2022-07-29 10:08:35 +03:00
joachimschmidt557 0fc79d602b stage2 ARM: more support for switch statements 2022-07-28 20:44:32 +00:00
Andrew Kelley 3ba7098a17 LLVM: fix returning extern union with C callconv 2022-07-27 17:56:15 -07:00
Andrew Kelley 6a4df2778e AstGen: fix ref instruction injection for functions
For the expressions regarding return type, alignment,
parameter type, etc.
2022-07-27 16:19:23 -07:00
Andrew Kelley 401abd793d run-translated-c: disable two failing tests
Issues reported:
 * #12263
 * #12264
2022-07-27 16:19:23 -07:00
Andrew Kelley f880af369d LLVM: fix lowering byte-aligned packed struct field pointers 2022-07-27 16:19:23 -07:00
Andrew Kelley dfc7493dcb Merge pull request #12256 from Vexu/stage2
stage2 typeInfo UAF fix + more
2022-07-27 16:11:07 -07:00
Andrew Kelley 90f23e131e Merge pull request #12252 from ziglang/stage3-test-cases
CI: run test-cases with stage3
2022-07-27 10:27:12 -07:00
Veikka Tuominen 793db63746 Sema: copy fn param ty in zirTypeInfo
Closes #12247
2022-07-27 18:27:17 +03:00
Veikka Tuominen 3818d63dd8 Sema: resolve pointee type in zirReify
Closes #12223
2022-07-27 17:11:46 +03:00
Evan Haas 7ba1f9bfb5 translate-c: take address of functions before passing them to @ptrToInt
Fixes #12194
2022-07-27 14:03:08 +03:00
Andrew Kelley bdaa915a02 test-cases: remove failing test
This causes a stack overflow in a debug build of stage3 unfortunately. I
will open an issue to track this test coverage, which we absolutely
should get working - users of the compiler should get a compile error,
not a segfault if they hit the default branch quota from abusing
recursive inline functions.

Note that the problem does not occur in a release build of stage3
which has significantly reduced stack usage.

On Linux, I tried bumping up the stack size from 32 MiB to 64 MiB and it
did not solve the problem. I'm not sure why not. It seems like it should
be fine.

Note that we also have a problem of running test-cases in multi-threaded
mode which is currently the default. Currently Zig threads are spawned
with 16 MiB stack space.
2022-07-26 20:12:40 -07:00
Andrew Kelley c8c798685f Merge pull request #12244 from Vexu/stage2
Minor stage2 fixes
2022-07-26 17:41:26 -07:00
Andrew Kelley e2d4709779 C ABI tests no longer apply to only stage1 2022-07-26 14:51:45 -07:00
Veikka Tuominen d6e3988fe8 Sema: better error when coercing error sets 2022-07-26 23:29:54 +03:00
Veikka Tuominen 5d99e5ecd4 Sema: improve expression value ignored error
Closes #4483
2022-07-26 16:40:24 +03:00
Veikka Tuominen 3d18c8c130 Sema: resolve lazy values for compile log
Close #12204
2022-07-26 16:40:24 +03:00
Veikka Tuominen d78532f462 Sema: give comptime_field_ptr priority over field_ptr in tuples
Closes #11983
2022-07-26 16:40:24 +03:00
Veikka Tuominen a463dc7d6c AstGen: disable null bytes and empty stings in some places
Namely:
 * test names
 * identifiers
 * library names
 * import strings
2022-07-26 12:14:59 +03:00
Veikka Tuominen 825fc654b6 Sema: better source location for builtin options 2022-07-26 12:14:59 +03:00
Veikka Tuominen 28478a4bac Module: improve handling of errors in @call arguments 2022-07-26 12:14:59 +03:00
Veikka Tuominen 2f34d06d01 Sema: analyzeInlineCallArg needs a block for the arg and the param 2022-07-25 22:04:08 +03:00
Luuk de Gram 9a3dacc00e Merge pull request #12188 from Luukdegram/llvm-wasm-c-abi
stage2: llvm - Implement C ABI when targetting wasm32
2022-07-25 16:12:36 +02:00
Andrew Kelley 0d120fcb89 Merge pull request #12225 from ziglang/ci-stage3-standalone
CI stage3 test coverage for test-standalone and test-cli
2022-07-25 00:46:56 -07:00
Luuk de Gram a7417f7839 wasm: Enable C-ABI tests for self-hosted compiler 2022-07-25 06:34:00 +02:00
Luuk de Gram 7c13bdb1c9 Merge pull request #12059 from Luukdegram/linker-tests-run-step
Implement EmulatableRunStep for linker tests
2022-07-25 06:33:01 +02:00