2761 Commits

Author SHA1 Message Date
Tadeo Kondrak
c002a5026a
Update code to not use unsupported calling conventions for target 2020-11-19 14:01:07 +02:00
LemonBoy
2b7781d82a stage1: Fix undefined assignment for bitfields
Prevents silent memory corruption.

Closes #7055
2020-11-18 21:49:39 -08:00
pfg
cf7de64f1a stage1: improve error for missing a number type on a runtime var 2020-11-18 21:45:51 +02:00
Veikka Tuominen
a6470088c6
Merge pull request #6434 from daurnimator/fifo.pump
std: add LinearFifo(...).pump(src_reader, dest_writer)
2020-11-18 16:35:13 +02:00
frmdstryr
a39d3155b4 Change error when runtime value passed to comptime arg 2020-11-18 13:33:45 +02:00
LemonBoy
129ccad434 stage1: Reject undefined values when taking union ptr
The code rightfully assumes the union_val object to be fully initialized.

Closes #7019
2020-11-18 13:21:36 +02:00
Veikka Tuominen
6d5b76a75d
Merge pull request #7005 from jshholland/deprecate-span
Remove ArrayList.span
2020-11-18 13:14:48 +02:00
LemonBoy
fa27420b72 stage1: Fix asyncCall with non-abi-aligned arguments
Make the code used to calculate the variable slot index into the frame
match what's done during the structure layout calculation.

Prevents a few nasty LLVM errors when such types are passed around.
2020-11-17 15:55:12 -08:00
Andrew Kelley
d9c36cb250
Merge pull request #6878 from frmdstryr/multiline-string-comments
Support comments in multiline string literals
2020-11-16 14:05:15 -08:00
Alexandros Naskos
6e2e747b0b
Merge pull request #7112 from LemonBoy/fix-7104
stage1: Fix generation of pass-by-value args in async fns
2020-11-16 09:12:42 +02:00
LemonBoy
7ebbc717c0 stage1: Fix generation of pass-by-value args in async fns
The mismatch between the argument slot type in the frame structure and
the one used in the store operation made the generated code write
garbage over the nearby fields.

Fixes #7104
2020-11-14 15:30:06 +01:00
LemonBoy
c4fd3fc270 stage1: Resolve ErrorUnion children types
Since the code is accessing the abi_size field compute the full type
size for both err_set_type and payload_type, not only for the latter.
2020-11-13 14:28:40 -07:00
Jakub Konka
51717314e4
Merge pull request #6900 from joachimschmidt557/stage2-aarch64
Add stage2 AArch64 backend
2020-11-12 20:41:15 +01:00
joachimschmidt557
b17859b568
stage2 AArch64: add Linux Hello World test 2020-11-11 23:29:18 +01:00
Jakub Konka
5b92d0ea45 stage2 aarch64: add macOS incremental test 2020-11-11 15:36:47 +01:00
Vexu
08270d72b4 ensure TypeInfo payload is not undefined 2020-11-11 16:04:46 +02:00
LemonBoy
5872ae5111 stage1: Fix crash in comptime struct generation
Using the gen_index rather than the src_index is needed to handle
structures containing zero-sized or comptime only types.

Closes #7027
2020-11-11 15:35:19 +02:00
LemonBoy
f0b1b74d21 stage1: Avoid resolving type entry in [0]T
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.

Closes #7058
2020-11-11 13:53:24 +02:00
LemonBoy
4d4ab1e69a stage1: Fix comparison of unions containing zero-sized types
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!

Fixes #7047
2020-11-10 17:21:49 -05:00
LemonBoy
e00356d6b1 stage1: Print correct error message for vector @intCast 2020-11-09 18:24:48 -05:00
Josh Holland
c25b157dda remove deprecated uses of ArrayList.span 2020-11-07 11:15:44 +00:00
xackus
5c8f7f81cd change debug.assert to testing.expect in tests 2020-11-06 22:48:54 +01:00
Andrew Kelley
d1b1f053b0
Merge pull request #6941 from LemonBoy/floateqapprox
std: Implement more useful approxEq semantics
2020-11-06 14:09:31 -05:00
Vexu
79549e0ac1
translate-c: fix macro functions with no arguments 2020-11-06 12:48:52 +02:00
LemonBoy
78840c4ab2 stage1: Make sure union(enum(T)) is valid
The T type should be wide enough to fit values in the  0...num field
range.

Closes #6988
2020-11-05 17:24:04 -05:00
LemonBoy
ff14451b4a std: Implement more useful approxEq semantics
Comparisons with absolute epsilons are usually useful when comparing
numbers to zero, for non-zero numbers it's advised to switch to relative
epsilons instead to obtain meaningful results (check [1] for more
details).

The new API introduces approxEqAbs and approxEqRel, where the former
aliases and deprecated the old `approxEq`, allowing the user to pick the
right tool for the job.

The documentation is meant to guide the user in the choice of the
correct alternative.

[1] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
2020-11-05 16:08:49 +01:00
LemonBoy
be26c3bf4e stage1: Fix *WithOverflow intrinsics with u0 values
Closes #5369
2020-11-02 13:40:00 -05:00
LemonBoy
4fd1ec78e9 std: Re-enable union behaviour test for mips targets 2020-11-02 11:46:26 +01:00
Andrew Kelley
909aae8153
Merge pull request #6792 from koachan/sparc64-linux
Initial sparc64-linux bringup
2020-11-01 22:14:56 -05:00
LemonBoy
0d6a7088dc stage1: Implement Add/Mul reduction operators 2020-11-01 14:30:31 -07:00
Veikka Tuominen
9ca9819488
Merge pull request #6883 from Vexu/translate-c
translate-c: correctly handle pointers to opaque demoted structs
2020-10-31 15:25:14 +02:00
Vexu
28a0583b84
run zig fmt on src/ and test/ 2020-10-31 12:21:49 +02:00
Veikka Tuominen
7c8d9cfa40
Merge pull request #6660 from Vexu/stage2
Stage2 switch and package imports
2020-10-31 09:39:28 +02:00
Vexu
3ff381385a
translate-c: correctly handle pointers to opaque demoted structs 2020-10-31 09:30:13 +02:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
frmdstryr
1d22591299 Add tests and fix \n between comments 2020-10-30 11:20:16 -04:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
Vexu
22ec5e0859
stage2: fix typo in liveness; add comptime switch test 2020-10-30 15:58:13 +02:00
LemonBoy
490cafe2c5 stage1: Error out when trying to execute unreachable
Closes #6802
2020-10-29 20:06:52 -04:00
LemonBoy
4fb896f16e
stage1: Fix bug in internal string slicing (#6843)
Closes #6456
2020-10-29 14:38:13 -04:00
Travis
960b5b518f updated zig tokenizer to handle .*** and added tests 2020-10-29 12:03:45 -05:00
LemonBoy
b3314a8be6 stage1: Fix small bug in pointer type analysis
A flag meant to catch recursively-defined types was never reset, leading
the compiler to generate wrong answers when asked for its
type/alignment.

Closes #6850
2020-10-29 15:41:45 +02:00
LemonBoy
7bc9531698 stage1: Correctly generated optional constant values
Closes #6799
2020-10-28 21:56:28 +02:00
LemonBoy
6d2f103bfb stage1: Fix crash in comptime struct value copy
Comptime fields are never materialized in the ZigValue so pay attention
when iterating over the fields array.

Fixes #6800
2020-10-28 21:13:32 +02:00
Koakuma
3a58b2330c Update stack traces testcases 2020-10-28 17:46:26 +07:00
frmdstryr
1ce0994897 Fix @import of empty file 2020-10-26 13:29:32 -07:00
Andrew Kelley
e83334274f add regression test for already fixed bug
closes #6781
2020-10-26 13:18:44 -07:00
Andrew Kelley
392e6da8a3 update stack trace test case 2020-10-22 21:57:30 -07:00
Andrew Kelley
e02655798f
Merge pull request #6743 from LemonBoy/someppc64stuff
Some ppc64 stuff
2020-10-22 17:39:26 -04:00
Andrew Kelley
e6ac082437
Merge pull request #6744 from LemonBoy/intcast-vec
stage1: Implement `@intCast` between vectors
2020-10-22 17:36:18 -04:00