2783 Commits

Author SHA1 Message Date
Andrew Kelley
429a219f42 stage2: fix not detecting all dynamic libraries
Positional shared library arguments were not being detected as causing
dynamic linking, resulting in invalid linker lines. LLD did not have an
error message for this when targeting x86_64-linux but it did emit an
error message when targeting aarch64-linux, which is how I noticed the
problem.

This surfaced an error having to do with fifo.pipe() in the cat example
which I did not diagnose but solved the issue by doing the revamp that
was already overdue for that example.

It appears that the zig-window project was exploiting the previous
behavior for it to function properly, so this prompts the question, is
there some kind of static/dynamic executable hybrid that the compiler
should recognize? Unclear - but we can discuss that in #7240.
2020-11-30 20:25:28 -07:00
Andrew Kelley
263f25fea6
Merge pull request #7116 from joachimschmidt557/stage2-arm
stage2 ARM: add basic arithmetic instructions
2020-11-29 10:43:29 -08:00
LemonBoy
df99cfdf1e stage1: Fix typeInfo generation for arrays w/o sentinel
ZigTypeIdOptional types have a different way of specifying their payload
value depending on whether the child type is a pointer or not (plus some
other special cases).

Fixes #7251
2020-11-29 10:39:10 -08:00
LemonBoy
c80d196094 stage1: Add missing bitcast when rendering var ptr
Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.

Fixes #7250
2020-11-29 10:37:06 -08:00
joachimschmidt557
ceebcb2b4d
stage2 ARM: add test case for addition 2020-11-28 23:26:17 +01:00
LemonBoy
f91df39ad2 stage1: Fix crash in *[N]T to []T conversion with zst
Prevent the crash by not making the codegen try to access the
non-existing ptr field in the slice.

Closes #6951
2020-11-27 14:33:26 -08:00
Jakub Konka
f125c4f5c7 stage2 macho: enable end-to-end incremental linking tests on aarch64 2020-11-26 11:50:09 +01:00
LemonBoy
58c2bec589 stage1: Fix ICE when generating struct fields with padding
Make gen_const_ptr_struct_recursive aware of the possible presence of
some trailing padding by always bitcasting the pointer to its expected
type.

Not an elegant solution but makes LLVM happy and is consistent with how
the other callsites are handling this case.

Fixes #5398
2020-11-25 15:36:33 -08:00
Andrew Kelley
500fbdad57 update stack trace test with new start.zig line number 2020-11-25 00:40:50 -07:00
LemonBoy
bfa7e5c743 Update stack_traces test 2020-11-23 12:36:03 +01:00
Andrew Kelley
bf0cc32aa6
Merge pull request #7165 from LemonBoy/ppc64final
Make the PPC64 port usable
2020-11-20 17:40:17 -08:00
LemonBoy
6029114f84 stage1: Resolve usingnamespace decls when calling @typeInfo
Closes #7176
2020-11-20 17:01:23 -08:00
LemonBoy
2193bbfd93 Skip f16 to f128 conversion test for ppc64
As for aarch64 we're waiting for LLVM to emit calls to the specific
builtins that implement this conversion.
2020-11-20 08:38:11 +01:00
LemonBoy
f2b4e6b2e7 Better coverage in @splat tests
Cover more common and uncommon cases.
2020-11-20 08:38:10 +01:00
Andrew Kelley
73be59433f
Merge pull request #6928 from data-man/reduce_tests
Add more tests for reduce
2020-11-19 17:48:18 -08:00
Veikka Tuominen
cf819b95fe
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 19:03:08 +02:00
Tadeo Kondrak
25ec2dbc1e Add builtin.Signedness, use it instead of is_signed 2020-11-19 18:59:21 +02:00
Vexu
3a28b659bd
add compile-error tests for unsupported calling convention 2020-11-19 14:25:46 +02:00
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
data-man
86b86bef23 Added links to the relevant issue 2020-11-17 14:41:05 +05: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
data-man
df4fd94525 remove f128 tests, disable min/max for NaNs 2020-11-04 17:42:57 +05:00
LemonBoy
be26c3bf4e stage1: Fix *WithOverflow intrinsics with u0 values
Closes #5369
2020-11-02 13:40:00 -05:00
data-man
ae73e0911d Remove min/max tests for NaNs 2020-11-02 20:40:41 +05:00
data-man
f0610d99f1 Add more tests for reduce 2020-11-02 16:48:59 +05:00
LemonBoy
4fd1ec78e9 std: Re-enable union behaviour test for mips targets 2020-11-02 11:46:26 +01:00