[compiler-rt] [clang] [libcxx] [libcxxabi] [libunwind] [llvm] [lldb] [lld] [libc] [clang-tools-extra] [flang] Fix a bug in Smith's algorithm used in complex div. (PR #78330)

Zahira Ammarguellat via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 06:16:59 PST 2024


================
@@ -2712,9 +2712,22 @@ static void EmitComplexRangeDiag(const Driver &D,
         << EnumComplexRangeToStr(Range1) << EnumComplexRangeToStr(Range2);
 }
 
-static std::string RenderComplexRangeOption(std::string Range) {
+static std::string
+RenderComplexRangeOption(LangOptions::ComplexRangeKind Range) {
   std::string ComplexRangeStr = "-complex-range=";
-  ComplexRangeStr += Range;
+  switch (Range) {
+  case LangOptions::ComplexRangeKind::CX_Full:
+    ComplexRangeStr += "full";
+    break;
+  case LangOptions::ComplexRangeKind::CX_Limited:
+    ComplexRangeStr += "limited";
+    break;
+  case LangOptions::ComplexRangeKind::CX_Fortran:
+    ComplexRangeStr += "fortran";
+    break;
+  case LangOptions::ComplexRangeKind::CX_None:
+    ComplexRangeStr = "";
----------------
zahiraam wrote:

Oh! you are right. We should actually never land here because I am calling RenderComplexRangeOption with this condition:
if (Range != LangOptions::ComplexRangeKind::CX_None)
    ComplexRangeStr = RenderComplexRangeOption(Range);
I guess an llvm-unreachable" should be added here?

https://github.com/llvm/llvm-project/pull/78330


More information about the cfe-commits mailing list