[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-13 Thread via cfe-commits
https://github.com/Sirraide closed https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-13 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM, thank you for the fix! https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-12 Thread via cfe-commits
Sirraide wrote: Alright, just checking that the AST dump doesn’t contain `FloatingRealToComplex` seems to work pretty well. https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-12 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/83063 >From 5418bec794ad1df54f49a1c8d317a75d56290239 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Mon, 26 Feb 2024 19:53:42 +0100 Subject: [PATCH 1/4] [Clang] [Sema] Remove incorrect int-to-complex-float conversion

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-12 Thread via cfe-commits
@@ -0,0 +1,143 @@ +// RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s --check-prefix=X86 + +// Check that for 'F _Complex + int' (F = real floating-point type), we emit an +// implicit cast from 'int' to 'F', but NOT to 'F _Complex' (i.e. that

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-12 Thread Aaron Ballman via cfe-commits
@@ -0,0 +1,143 @@ +// RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s --check-prefix=X86 + +// Check that for 'F _Complex + int' (F = real floating-point type), we emit an +// implicit cast from 'int' to 'F', but NOT to 'F _Complex' (i.e. that

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-11 Thread via cfe-commits
Sirraide wrote: @jcranmer-intel @AaronBallman Do you think there’s anything else that needs to be done here, or is it fine as-is? https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llv

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-05 Thread via cfe-commits
@@ -0,0 +1,143 @@ +// RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s --check-prefix=X86 + +// Check that for 'F _Complex + int' (F = real floating-point type), we emit an +// implicit cast from 'int' to 'F', but NOT to 'F _Complex' (i.e. that

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-05 Thread via cfe-commits
@@ -1114,8 +1114,6 @@ static bool handleIntegerToComplexFloatConversion(Sema &S, ExprResult &IntExpr, if (IntTy->isIntegerType()) { QualType fpTy = ComplexTy->castAs()->getElementType(); IntExpr = S.ImpCastExprToType(IntExpr.get(), fpTy, CK_IntegralToFloating); -

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-05 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/83063 >From 5418bec794ad1df54f49a1c8d317a75d56290239 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Mon, 26 Feb 2024 19:53:42 +0100 Subject: [PATCH 1/3] [Clang] [Sema] Remove incorrect int-to-complex-float conversion

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-04 Thread via cfe-commits
@@ -0,0 +1,143 @@ +// RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s --check-prefix=X86 + +// Check that for 'F _Complex + int' (F = real floating-point type), we emit an +// implicit cast from 'int' to 'F', but NOT to 'F _Complex' (i.e. that

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-04 Thread via cfe-commits
@@ -1114,8 +1114,6 @@ static bool handleIntegerToComplexFloatConversion(Sema &S, ExprResult &IntExpr, if (IntTy->isIntegerType()) { QualType fpTy = ComplexTy->castAs()->getElementType(); IntExpr = S.ImpCastExprToType(IntExpr.get(), fpTy, CK_IntegralToFloating); -

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-04 Thread Joshua Cranmer via cfe-commits
@@ -0,0 +1,143 @@ +// RUN: %clang_cc1 %s -O0 -emit-llvm -triple x86_64-unknown-unknown -o - | FileCheck %s --check-prefix=X86 + +// Check that for 'F _Complex + int' (F = real floating-point type), we emit an +// implicit cast from 'int' to 'F', but NOT to 'F _Complex' (i.e. that

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-03-04 Thread Joshua Cranmer via cfe-commits
@@ -1114,8 +1114,6 @@ static bool handleIntegerToComplexFloatConversion(Sema &S, ExprResult &IntExpr, if (IntTy->isIntegerType()) { QualType fpTy = ComplexTy->castAs()->getElementType(); IntExpr = S.ImpCastExprToType(IntExpr.get(), fpTy, CK_IntegralToFloating); -

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-27 Thread via cfe-commits
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/83063 >From 5418bec794ad1df54f49a1c8d317a75d56290239 Mon Sep 17 00:00:00 2001 From: Sirraide Date: Mon, 26 Feb 2024 19:53:42 +0100 Subject: [PATCH 1/2] [Clang] [Sema] Remove incorrect int-to-complex-float conversion

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-27 Thread via cfe-commits
Sirraide wrote: > > Since this is a relatively benign bug, all things considered, does this > > even warrant a release note? > > I think it should have a release note; it changes the layout of the AST which > may impact folks writing AST matchers (clang-tidy checks, etc). But also, I > think

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-27 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > Since this is a relatively benign bug, all things considered, does this even > warrant a release note? I think it should have a release note; it changes the layout of the AST which may impact folks writing AST matchers (clang-tidy checks, etc). But also, I think it does

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-26 Thread via cfe-commits
Sirraide wrote: >From what I can tell, this also fixes #31205 https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-26 Thread via cfe-commits
Sirraide wrote: Since this is a relatively benign bug, all things considered, does this even warrant a release note? https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-26 Thread via cfe-commits
@@ -10,34 +10,32 @@ _Complex float cf; int volatile vol =10; void f0() { const_cast(cf) = const_cast(cf) + 1; -// CHECK: %cf.real = load volatile float, ptr @cf -// CHECK: %cf.imag = load volatile float, ptr getelementptr -// CHECK: %add.r = fadd float %cf.real, 1.00

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-26 Thread via cfe-commits
Sirraide wrote: CC @AaronBallman https://github.com/llvm/llvm-project/pull/83063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-26 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (Sirraide) Changes C23 6.3.1.8 ‘Usual arithmetic conversions’ p1 states (emphasis mine): > Otherwise, if the corresponding real type of either operand is `float`, the other operand is converted, *without change of type domain*, to a

[clang] [Clang] [Sema] Fix bug in `_Complex float`+`int` arithmetic (PR #83063)

2024-02-26 Thread via cfe-commits
https://github.com/Sirraide created https://github.com/llvm/llvm-project/pull/83063 C23 6.3.1.8 ‘Usual arithmetic conversions’ p1 states (emphasis mine): > Otherwise, if the corresponding real type of either operand is `float`, the > other operand is converted, *without change of type domain*,