[clang][bytecode] Check Mulc op for numbers (#199657)

This commit is contained in:
Timm Baeder 2026-05-29 10:34:42 +02:00 committed by GitHub
parent c2e39974c8
commit 2e10a9f2e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -520,6 +520,11 @@ inline bool Mulc(InterpState &S, CodePtr OpPC) {
const T &RHSI = RHS.elem<T>(1);
unsigned Bits = LHSR.bitWidth();
// We only handle actual numbers here.
if (!LHSR.isNumber() || !LHSI.isNumber() || !RHSR.isNumber() ||
!RHSI.isNumber())
return false;
// real(Result) = (real(LHS) * real(RHS)) - (imag(LHS) * imag(RHS))
T A;
if constexpr (needsAlloc<T>())

View file

@ -185,3 +185,7 @@ union ToUnion_U { struct ToUnion_X x; double y; int z : 3; };
_Static_assert(((union ToUnion_U)(struct ToUnion_X){67}).x.a == 67, "");
_Static_assert(((union ToUnion_U)1.0).y == 1.0, "");
_Static_assert(((union ToUnion_U)9).z == 1, "");
struct S s; // both-error {{tentative definition has type 'struct S' that is never completed}} \
// both-note {{forward declaration of 'struct S'}}
int foo[2 * ((long)&s + 42i) == 2]; // both-error {{variable length array declaration not allowed at file scope}}