Commit Graph

32 Commits

Author SHA1 Message Date
Veikka Tuominen
b91d6ff9e8 add runtime safety for noreturn function returning
Closes #15221
2023-05-16 11:33:38 +03:00
Andrew Kelley
1ba72bcf9a update test cases for new memcpy/memset semantics 2023-04-25 11:23:41 -07:00
Andrew Kelley
83a7303bbf Sema: implement comptime @memset 2023-04-25 11:23:41 -07:00
Veikka Tuominen
f1e43d1f4f Sema: emit cast to null panics for function pointers
Closes #14676
2023-04-23 19:09:14 +03:00
Andrew Kelley
15d767c621 add safety test cases for multi-object for loops 2023-02-18 19:20:19 -07:00
Veikka Tuominen
17ff002bc0 Sema: improve safety panic for access of inactive union field 2022-11-29 21:44:08 +02:00
Veikka Tuominen
6337c04244 Sema: improve panic for slice start index being greater than end index
Closes #13689
2022-11-29 15:47:02 +02:00
Veikka Tuominen
2315e1b410 safety: add safety check for hitting else branch on a corrupt enum value
Closes #7053
2022-10-07 11:04:02 +03:00
Veikka Tuominen
694fab4848 std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
Veikka Tuominen
8f2e82dbf6 safety: show error return trace when unwrapping error in switch 2022-09-20 19:05:00 -07:00
Andrew Kelley
507aae4a1a make self-hosted the default compiler
stage1 is available behind the -fstage1 flag.

closes #89
2022-08-19 16:45:15 -07:00
Veikka Tuominen
09f273136c stage2: check for zero in @intToError safety 2022-08-12 11:41:09 +03:00
Andrew Kelley
b3d463c9e6
Merge pull request #12337 from Vexu/stage2-safety
Stage2: implement remaining runtime safety checks
2022-08-06 14:59:10 -07:00
Andrew Kelley
5c9826630d Sema: elide safety of modulus and remainder division sometimes
Piggybacking on 40f8f0134f, remainder
division, modulus, and `%` syntax no longer emit safety checks for a
comptime-known denominator.
2022-08-05 21:13:18 -07:00
Veikka Tuominen
f46d7304b1 stage2: add runtime safety for invalid enum values 2022-08-05 22:13:58 +03:00
Veikka Tuominen
19d5ffc710 Sema: add safety check for non-power-of-two shift amounts 2022-08-05 22:13:58 +03:00
Veikka Tuominen
9116e26c1f Sema: add null check for implicit casts 2022-08-05 22:13:58 +03:00
Veikka Tuominen
5605f6e0e3 Sema: account for sentinel in bounds check 2022-08-05 22:13:57 +03:00
Veikka Tuominen
6aa438f065 Sema: add null pointer slice safety check when len is comptime known 2022-08-05 22:13:57 +03:00
Veikka Tuominen
eec2978fac Sema: better safety check on switch on corrupt value 2022-08-05 22:13:57 +03:00
Veikka Tuominen
14f0b70570 Sema: add safety for sentinel slice 2022-08-02 18:34:30 +03:00
Veikka Tuominen
cf87026e52 Sema: @alignCast safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
711b656773 Sema: @floatToInt safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
ff7ec4efb5 Sema: bad union field access safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
55fe34100f Sema: exact division safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
76d099950a Sema: cast negative to unsigned safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
0782586b15 Sema: divide by zero safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
9f10dfcb54 Sema: implement shr_exact runtime safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
4d20d6874c move passing safety tests to stage2 2022-07-23 15:40:11 +03:00
Andrew Kelley
0cd43b0f86 runtime safety tests only on the native target
This matches master branch. We can look into adding more target coverage
as we switch to stage2. As it stands, this works around having to
duplicate the "Executor" logic to figure out when to not run the tests
due to them being non-native.
2022-05-13 17:59:06 -07:00
Andrew Kelley
7755f7863a disable a runtime safety test that is failing on WASI 2022-05-13 14:03:20 -07:00
Andrew Kelley
66f3efb63b migrate runtime safety tests to the new test harness
* migrate runtime safety tests to the new test harness
   - this required adding compare output / execution support for stage1
     to the test harness.
 * rename `zig build test-stage2` to `zig build test-cases` since it now
   does quite a bit of stage1 testing actually. I named it this way
   since the main directory in the source tree associated with these
   tests is "test/cases/".
 * add some documentation for the test manifest format.
2022-05-13 14:03:20 -07:00