13 Commits

Author SHA1 Message Date
Timm Baeder
e16ced3ef4
[clang][bytecode] Diagnose one-past-end reads from global arrays (#154484)
Fixes #154312
2025-08-20 10:34:44 +02:00
Timm Baeder
1b1f352cb9
[clang][bytecode] Handle reads on zero-size arrays (#152706) 2025-08-08 16:03:02 +02:00
Timm Baeder
7904298c79
[clang][bytecode] Don't ignore discarded ArraySubScriptExprs (#137526)
We need to evaluate them since the index might be out of bounds.
2025-04-27 20:10:41 +02:00
Timm Baeder
6196b4ee8c
[clang][bytecode] Don't set OnePastEnd bit for array elements (#136422)
If we refer to arr[N], don't set the OnePastEnd bit of the APValue,
since that is already encoded in the array index.
2025-04-19 16:48:49 +02:00
Timm Baeder
ecbd2d5e14
[clang][ExprConst] Diagnose ptr subs with non-zero offset (#135938)
The attached test case was missing the note.
2025-04-17 17:27:19 +02:00
Timm Baeder
559df834df
[clang][bytecode] Fix subtracting zero-sized pointers (#135929)
Add the appropriate diagnostic and fix the d-d case.
2025-04-16 10:48:42 +02:00
Timm Baeder
bdd087023f
[clang][bytecode] Fix various issues with multidimensional arrays (#134628)
This issue is very convoluted, but in essence, in the new version:

For a Pointer P that points to the root of a multidimensional, primitive
array:

`P.narrow()` does nothing.
`P.atIndex(0)` points `P[0]`
`P.atIndex(0).atIndex(0)` is the same as `P.atIndex(0)` (as before)
`P.atIndex(0).narrow().atIndex(0)` points to `P[0][0]`
`P.atIndex(0).narrow().narrow()` is the same as `P.atIndex(0).narrow()`.
2025-04-08 05:48:55 +02:00
Timm Baeder
dfa3af9255
[clang][bytecode] Expand subscript base if of pointer type (#128511)
This is similar to what we do in the AddOffset instruction when adding
an offset to a pointer.
2025-02-25 11:40:05 +01:00
Timm Baeder
19a39e98ff
[clang][bytecode] Handle non-primitive array index expressions (#128479)
By rejecting them instead of asserting in `classifyPrim()`.
2025-02-24 09:36:48 +01:00
Timm Bäder
a0bd40e5a3 Revert "[clang][bytecode] Mark global decls with diagnostics invalid (#122895)"
This reverts commit c1de9b920935e7d2fcc8dd7b39c1b7285783e948.

It looks like this breaks the memory-sanitizer builder:
https://lab.llvm.org/buildbot/#/builders/94/builds/3745
2025-01-14 18:37:36 +01:00
Timm Baeder
c1de9b9209
[clang][bytecode] Mark global decls with diagnostics invalid (#122895)
Even if their evaluation succeeds, mark them as invalid. This fixes some
long standing differences to the ast walker interpeter.
2025-01-14 15:10:48 +01:00
Timm Baeder
f7a74ece5a
[clang][bytecode] Diagnose array-to-pointer decays of dummy pointers (#106366)
We have type information for them now, so we can do this.
2024-08-28 13:41:01 +02:00
Timm Baeder
a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00