Commit Graph

586 Commits

Author SHA1 Message Date
Kelly Boothby
44aadaff59 added unit tests to demonstrate #4769 and related bugs 2020-03-30 18:29:48 -07:00
Andrew Kelley
c70471fae6
enable now-passing test cases
These can now be enabled thanks to bug fixes that landed in
LLVM 10.
2020-03-29 10:34:12 -04:00
Andrew Kelley
ddd98a7f10
prevent ptr cast from forcing alignment resolution unnecessarily 2020-03-26 12:34:16 -04:00
Andrew Kelley
93c7fa105f
Merge remote-tracking branch 'origin/llvm10'
LLVM 10 was released today
2020-03-24 09:57:09 -04:00
LemonBoy
0cd953d40e ir: Prevent crash when slicing hardcoded pointer
Closes #4780
2020-03-23 09:13:52 -04:00
Andrew Kelley
13d04f9963
Merge pull request #4741 from momumi/master
allow `_` separators in number literals (stage 1)
2020-03-23 00:54:54 -04:00
Andrew Kelley
e5e5196d8e
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 20:48:21 -04:00
LemonBoy
6a89751025 ir: Implement cast from anon struct to union 2020-03-22 19:06:22 -04:00
Andrew Kelley
23c263776c
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-22 15:09:29 -04:00
LemonBoy
28dbc58837 Address review comments 2020-03-21 09:54:49 +01:00
LemonBoy
128e70ff3a ir: Allow errdefer with payload
Closes #1265
2020-03-21 09:54:49 +01:00
LemonBoy
541e763010 ir: Peer type resolution between ?[]T and *[N]T
Closes #4767
2020-03-20 12:23:05 -04:00
Andrew Kelley
53b5aa812b
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -04:00
Andrew Kelley
8ddf9d84ff
add behavior tests for slicing with comptime indexes 2020-03-19 11:17:46 -04:00
Andrew Kelley
f824658e13
slicing sentinel-terminated slice without end
now results in a sentinel-terminated slice.
2020-03-19 10:54:20 -04:00
Andrew Kelley
b5dba702ff
fixes to std.meta
behavior tests are passing now
2020-03-19 09:53:55 -04:00
Andrew Kelley
2164b511cc
partial revert of an improvement this branch made
because it uncovered a result location bug, and I need to get this
branch merged before going into a result location rabbit hole.

also fix the result type of slicing when the indexes are runtime known
and the result should be sentinel terminated.
2020-03-19 09:53:55 -04:00
Andrew Kelley
2b4134459d
fix alignment when slicing with comptime start and end index 2020-03-19 09:53:54 -04:00
Andrew Kelley
0707be8de8
fixes in semantic analysis needed to support this feature 2020-03-19 09:53:54 -04:00
LemonBoy
e3c92d0532 ir: More changes to sentinel-terminated const arrays
* Don't add an extra slot for the sentinel. Most of the code keeps using
  the constant value from the type descriptor, let's harmonize all the
  code dealing with sentinels.

* Properly write out sentinel values when reinterpreting pointers at
  comptime.

* Allow the reading of the 0th element in a `[0:S]T` type.
2020-03-19 09:53:30 -04:00
LemonBoy
1479c28b49
ir: Correct ABI size calculation for arrays
Zero-length array with a sentinel may not have zero size.

Closes #4749
2020-03-18 11:10:45 -04:00
momumi
7aac21c6f5 allow _ separators in number literals (stage 1)
* Underscores `_` may be placed between two digits in a int/float literal
* Consecutive underscores are not allowed
* Fixed parsing bug in exponents of hexadecimal float literals.
  Exponents should always be base 10, but hex characters would be parsed
  inside the exponent and everything after them would be ignored. eg:
  `0x1.0p1ab1` would be parsed as `0x1.0p1`.
2020-03-15 12:38:35 +10:00
Andrew Kelley
656ba530d8
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Andrew Kelley
f51bec321b
Merge pull request #4707 from Vexu/small-atomics
Support atomic operations with bools and non power of two integers
2020-03-12 18:55:16 -04:00
Vexu
71d776c3be
add note to disabled tests, improve comptime cmpxchg 2020-03-12 22:42:01 +02:00
Vexu
6dde769279
Simplify stores, use sext for signed ints 2020-03-12 22:02:58 +02:00
Vexu
ce19638cd4
disable test on mipsel 2020-03-12 17:31:10 +02:00
Vexu
710b05b153
support @atomicRmw at comptime 2020-03-12 16:46:16 +02:00
Vexu
ec906a9771
fix codegen, update docs 2020-03-11 13:55:52 +02:00
Vexu
1f66435a6b
support cmpxchg at comptime 2020-03-11 12:02:05 +02:00
Vexu
64e60d8ae2
special case atomic operations on zero bit types 2020-03-11 10:29:15 +02:00
LemonBoy
4ab13a359d ir: Fix shift code for u0 operands 2020-03-10 23:04:49 +01:00
Vexu
8dc188ebe0
support atomic operations with bools 2020-03-10 22:33:32 +02:00
LemonBoy
1f44b29724 ir: Fix codegen of ?*T types where T is zero-sized
* Fix codegen for optional types that decay to a pointer, the type
  behaves as a boolean
* Fix comptime evaluation of zero-sized arrays, always initialize the
  internal array elements

Closes #4673
2020-03-09 22:08:56 -04:00
Andrew Kelley
638d5c3aca
Merge pull request #4700 from Vexu/noasync
Implement new noasync syntax
2020-03-09 18:36:01 -04:00
LemonBoy
14bbb82832
ir: Fix lazy comparison between @alignOf and zero
Closes #4527
2020-03-09 14:05:38 -04:00
Vexu
3fd2cd4367
add LemonBoy's test 2020-03-09 18:43:09 +02:00
LemonBoy
e2fd289a33 ir: Create usize result_loc for array subscript expr
Allow the subscript expression to infer the resulting type.

Closes #4169
2020-03-08 18:52:44 -04:00
Andrew Kelley
96c07674fc
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-07 12:18:41 -05:00
Andrew Kelley
fa46bcb368
stage1: make get_optional_type more robust
Now it will emit a compile error rather than crashing when the child
type has not been resolved properly.

Introduces `get_optional_type2` which should be used generally inside
ir.cpp.

Fix some std lib compile errors noticed by the provided test case.

Thanks @LemonBoy for the test case. Closes #4377.

Fixes #4374.
2020-03-06 18:30:30 -05:00
Andrew Kelley
01c722c21c
Revert "Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value."
This reverts commit debcc79d56.

This caused a regression when building self-hosted
2020-03-05 17:19:01 -05:00
Alexandros Naskos
debcc79d56 Allow constant struct val to reallocate its fields when resolving an inferred struct field with a comptime value. 2020-03-05 15:48:03 -05:00
LemonBoy
0c310f0fbf
ir: Implement @TypeOf with multiple arguments
Closes #439
2020-03-04 17:21:10 -05:00
Andrew Kelley
24fc69acad
Merge pull request #4573 from alexnask/tuple_concat
Allow concatenation of tuples that contain a mix of runtime and comptime values
2020-03-04 17:09:43 -05:00
Andrew Kelley
f247a90541
get_codegen_ptr_type returns possible error
And fix most of the fallout. This also makes optional pointers not
require resolving zero bits, because the comptime value struct layout no
longer depends on whether the type has zero bits.

Thanks to @LemonBoy for the behavior test case

Closes #4357
Closes #4359
2020-03-04 17:04:59 -05:00
Andrew Kelley
66e6f5586e
enable f128 test on windows 2020-03-03 09:49:08 -05:00
Andrew Kelley
d1cb16aace
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-03 09:44:13 -05:00
Alexandros Naskos
b838122cc0 Merge branch 'master' of https://github.com/ziglang/zig into tuple_concat 2020-03-02 00:55:19 +02:00
Andrew Kelley
ef3d761da5
breaking: std.mem.len no longer takes a type argument
also update fmt code to use std.mem.span.
2020-03-01 13:21:39 -05:00
Andrew Kelley
4505857e30
revert changes outside std.fmt 2020-03-01 13:07:31 -05:00