Vexu
b1e44adcba
move array and struct const checks to more appropriate places
2020-04-08 14:32:02 +03:00
Vexu
ff0f97a1bc
fix missing compile error on assign to slice and array parameters
2020-04-08 00:27:14 +03:00
Vexu
e62671f643
fix missing const on address of literal
2020-04-07 15:25:44 +03:00
LemonBoy
a59d31bd28
ir: Support tuple multiplication
2020-04-06 14:03:43 -04:00
LemonBoy
d2d97e55cc
ir: Support shift left/right on vectors
2020-04-05 18:34:31 -04:00
LemonBoy
2485f30046
ir: Support bitwise not on vectors
2020-04-05 18:34:31 -04:00
LemonBoy
54ffcf95a8
ir: Support div/mod/rem on vector types
...
Closes #4050
2020-04-05 18:34:31 -04:00
LemonBoy
ad2ebc87f2
stage1: Byteswap floats when serializing them
2020-04-04 16:55:24 +02:00
LemonBoy
084c62f5d1
stage1: Fix serialization of ZigValue on BE machines
2020-04-04 14:06:32 +02:00
Michael Dusan
db4c06ce60
stage1: add compile errors for sentinel slicing
...
closes #3963
2020-04-03 19:05:30 -04:00
Andrew Kelley
783f73c7e3
zig cc properly handles -S flag and .ll, .bc extensions
2020-04-01 16:01:06 -04:00
LemonBoy
6695fa4f32
ir: Fix comparison of ?T values
...
The code assumed that every ?T had a pointer child type T, add some more
checks to make sure the type is effectively a pointer.
Closes #4789
2020-04-01 15:56:38 -04:00
Michael Dusan
212e2354b8
stage1: make C++ switch fallthrough an error
...
Make fallthrough an error when compiler supports it. This requires a new
macro that is defined with such compilers to be used as a statement, at
all fallthrough sites:
switch (...) {
case 0:
...
ZIG_FALLTHROUGH;
case 1:
...
break;
default:
...
break;
}
If we ever move to C++17 as minimal requirement, then the macro can be
replaced with `[[fallthrough]];` at statement sites.
2020-04-01 15:56:00 -04:00
Timon Kruiper
d33766e6c7
Make sure that ZigTypeVector and ZigTypeArray have the same memory layout
...
Throughout the stage1 code it is assumed that these have the same layout,
but that was not the case. This caused an issue on 32-bit hardware.
2020-04-01 20:50:13 +02:00
Timon Kruiper
d9cf779b47
Fix some nullptr dereferences on arm-linux-musleabhif
2020-04-01 20:38:32 +02:00
Andrew Kelley
b980568c81
add peer type resolution for mixed-const []T and *[N]T
...
closes #4766
This commit also fixes the implementation of some utility functions for
adjusting properties of pointer types. Previously these functions would
incorrectly drop vector, sentinel, and inference metadata.
2020-03-30 13:02:50 -04:00
LemonBoy
c1cc1ebc35
ir: Avoid constant-folding ptr to sentinels
...
Constant-folding the pointers to the expected sentinel value have some
big problems: it hides the real content of the array, makes the pointer
to the sentinel point to a completely different memory region and treats
it like a const value even when the underlying array is mutable.
Fixes #4840
2020-03-30 11:03:56 -04:00
Andrew Kelley
0d4354324c
fix behavior tests compile error on i386-linux
2020-03-26 12:54:59 -04:00
Andrew Kelley
ddd98a7f10
prevent ptr cast from forcing alignment resolution unnecessarily
2020-03-26 12:34:16 -04:00
Andrew Kelley
5ec6a0ea02
fix an invalid free having to do with bound functions
...
this should fix the drone CI failure
2020-03-25 21:00:02 -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
94f7c56001
riscv: add -mrelax arg for C to work around upstream issue
...
See #4485
2020-03-22 21:47:19 -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
dc79f181a5
ir: Disallow comparison between enum literal and untagged enum
...
Closes #4770
2020-03-21 20:54:05 -04: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
160367e0dd
fix compile error for reading past end of pointer casted array
2020-03-19 17:23:53 -04:00
Andrew Kelley
1d7861a36e
fix incorrect sentinel check
2020-03-19 13:18:14 -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
7fa88cc0a6
std lib fixups for new semantics
...
std lib 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
8688c43745
when result loc is a slice, avoid evaluating lazy start..end
...
This prevents lazy values from being unnecessarily evaluated.
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
8d0ac6dc4d
@ptrCast supports casting a slice to pointer
2020-03-19 09:53:54 -04:00
Andrew Kelley
c896c5001f
fix slice of string literal having the wrong type
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
Andrew Kelley
2182d28cb0
slicing with comptime start and end results in array
...
implements #863
2020-03-19 09:53:51 -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
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
710b05b153
support @atomicRmw at comptime
2020-03-12 16:46:16 +02:00
Vexu
9262f065f5
Move abi size checking to codegen
2020-03-11 16:48:18 +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