Vexu
f127dee474
Merge pull request #5267 from Vexu/const-call
...
Fix missing compile error on call assigned to const
2020-05-04 21:45:15 +03:00
Vexu
adc444ceeb
fix missing compile error on call assigned to const
2020-05-04 14:28:58 +03:00
Michael Dusan
09d6dc1ce6
stage1: cleanup
...
- remove unused IrInstSrcOptionalUnwrapPtr.initializing
2020-05-01 18:01:21 -04:00
Tadeo Kondrak
249938dde0
Validate vector types for @Vector
2020-04-28 00:24:45 -06:00
Tadeo Kondrak
45f4a1124f
implement @Type() for more types
2020-04-27 14:37:18 -04:00
LemonBoy
a7a8c433d0
stage1: Prevent the creation of illegal ptr types
...
Closes #5140
2020-04-24 15:55:32 -04:00
xackus
a9eb4a6740
stage1: fix crash on accessing an array of size zero with runtime index
2020-04-23 12:45:32 -04:00
LemonBoy
e6428f9401
stage1: Fix bitcast of immediate to ptr type ( #5131 )
...
Consider a (legal according to the `@bitCast` rules) conversion from u16
to [2]u8: since the former is a scalar and the latter is a pointer
(arrays are represented at pointers in the codegen phase) we have to
allocate a temporary slot on the stack and then bitcast the resulting
pointer to the desired destination type.
Beware that this means the lifetime of the resulting value is the same
of the function it's contained in and for all intents and purposes
should be regarded as a local (eg. it should not escape).
Closes #4395
Closes #5121
2020-04-23 12:44:16 -04:00
Andrew Kelley
e8545db9d4
Merge pull request #5130 from ziglang/stage2-ir
...
beginnings of non-LLVM self-hosted backend
2020-04-22 14:42:46 -04:00
LemonBoy
b5e72c0148
stage1: Prevent the creation of illegal pointer types
...
Changing the pointer length from Unknown to Single/C now resets the
sentinel value too.
Closes #5134
2020-04-22 14:40:57 -04:00
Andrew Kelley
2cdbb5f472
ir: analyze int casting
2020-04-21 19:48:59 -04:00
elucent
48dc3b6fe9
Added peer type resolution for [*]T and *[N]T.
2020-04-21 18:09:03 -04:00
Michael Dusan
412aac8a70
cleanup: IrBasicBlockGen
...
remove unused param from `ir_ref_inst_gen`
2020-04-21 18:07:48 -04:00
Michael Dusan
73677e178d
cleanup: IrBasicBlockGen
...
remove unused members { parent, index, ref_count }
2020-04-21 18:07:48 -04:00
LemonBoy
aca6b70184
stage1: Handle errors when generating block IR
...
Closes #5005
2020-04-20 22:39:34 -04:00
xackus
d415ffd7d9
fix uninitialized ZigValue
2020-04-19 03:49:36 -04:00
Vexu
4f02cf32b4
fix typeInfo tests
2020-04-18 11:39:52 +03:00
Vexu
1afaf42525
add error for non-exter variadic functions
2020-04-17 22:02:49 +03:00
Vexu
c026a9f6d2
fix missing compile errors on builtin cast functions
2020-04-17 14:22:20 -04:00
foobles
022a71ca7d
Shift error message now says "fixed-width integer type" instead of just "integer type" ( #5028 )
...
* error message of ir_analyze_bit_shift now more accurate/specific
* fixed compile error test to match bit shift error message
2020-04-14 16:19:45 -04:00
Vexu
f60e7348d5
add error message for invalid assignment
2020-04-09 11:50:32 +03:00
Andrew Kelley
beae932e0f
Merge pull request #4975 from Vexu/param-reassign
...
Fix missing compile error on assign to slice and array parameters
2020-04-08 21:02:50 -04:00
Andrew Kelley
c45ba49b8b
fix formatted printing warning
...
needed to use ZIG_PRI_u64 instead of %lu
2020-04-08 19:30:18 -04:00
Vexu
b1e44adcba
move array and struct const checks to more appropriate places
2020-04-08 14:32:02 +03:00
xackus
66b2477ab6
fix lazy value in ir_analyze_instruction_elem_ptr
2020-04-07 18:22:17 -04: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