diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-03-03 19:28:37 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-03-03 22:42:34 +0200 |
| commit | aa7cbca7d37bb2cd7794ffa401193cdc3f5f9849 (patch) | |
| tree | 35ba6d6b69a3df9f661ba64202f31e0d8b1b6e5f /src | |
| parent | 69bd2c243e23fa2d4df2ec50802bd4b453211bfd (diff) | |
| download | zig-aa7cbca7d37bb2cd7794ffa401193cdc3f5f9849.tar.gz zig-aa7cbca7d37bb2cd7794ffa401193cdc3f5f9849.zip | |
stage2: make analyzePtrArithmetic no-op with offset=0
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 239d8cfc93..90de95b5d6 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -9494,6 +9494,8 @@ fn analyzePtrArithmetic( } const offset_int = try sema.usizeCast(block, offset_src, offset_val.toUnsignedInt()); + // TODO I tried to put this check earlier but it the LLVM backend generate invalid instructinons + if (offset_int == 0) return ptr; if (ptr_val.getUnsignedInt()) |addr| { const target = sema.mod.getTarget(); const ptr_child_ty = ptr_ty.childType(); |
