[llvm-branch-commits] [flang] 5244bb1 - Modify an IO format error message
Author: V Donaldson Date: 2022-01-04T10:34:07-08:00 New Revision: 5244bb18abbf70d2f4475fa8facb34d4d8af0d32 URL: https://github.com/llvm/llvm-project/commit/5244bb18abbf70d2f4475fa8facb34d4d8af0d32 DIFF: https://github.com/llvm/llvm-project/commit/5244bb18abbf70d2f4475fa8facb34d4d8af0d32.diff LOG: Modify an IO format error message F18 constraint C1308 is: For the G edit descriptor, e shall not be specified if w is zero. For an edit descriptor such as 'G0.2E4', change the error message from: error: Unexpected 'e' in 'G0' edit descriptor To: error: A 'G0' edit descriptor must not have an 'e' value Added: Modified: flang/include/flang/Common/format.h flang/test/Semantics/io07.f90 flang/test/Semantics/io08.f90 Removed: diff --git a/flang/include/flang/Common/format.h b/flang/include/flang/Common/format.h index e38ea6b0dfedf..7ca3faa79f290 100644 --- a/flang/include/flang/Common/format.h +++ b/flang/include/flang/Common/format.h @@ -606,8 +606,8 @@ template bool FormatValidator::Check() { check_e(); } } else if (token_.kind() == TokenKind::Point && check_d() && -token_.kind() == TokenKind::E) { - ReportError("Unexpected 'e' in 'G0' edit descriptor"); // C1308 +token_.kind() == TokenKind::E) { // C1308 + ReportError("A 'G0' edit descriptor must not have an 'e' value"); NextToken(); if (token_.kind() == TokenKind::UnsignedInteger) { NextToken(); diff --git a/flang/test/Semantics/io07.f90 b/flang/test/Semantics/io07.f90 index 5c4c2b419d978..9b1f048e5b17c 100644 --- a/flang/test/Semantics/io07.f90 +++ b/flang/test/Semantics/io07.f90 @@ -74,9 +74,9 @@ 8001 format(9G0.5) - !ERROR: Unexpected 'e' in 'G0' edit descriptor + !ERROR: A 'G0' edit descriptor must not have an 'e' value 8101 format(9(G0.5e1)) - !ERROR: Unexpected 'e' in 'G0' edit descriptor + !ERROR: A 'G0' edit descriptor must not have an 'e' value 8102 format(9(G0.5 E 1)) end diff --git a/flang/test/Semantics/io08.f90 b/flang/test/Semantics/io08.f90 index c074e1562e222..843028acfd5bf 100644 --- a/flang/test/Semantics/io08.f90 +++ b/flang/test/Semantics/io08.f90 @@ -189,10 +189,10 @@ !ERROR: Expected 'G' edit descriptor '.d' value write(*,'(G4)') - !ERROR: Unexpected 'e' in 'G0' edit descriptor + !ERROR: A 'G0' edit descriptor must not have an 'e' value write(*,'(G0.8e)') - !ERROR: Unexpected 'e' in 'G0' edit descriptor + !ERROR: A 'G0' edit descriptor must not have an 'e' value write(*,'(G0.8e2)') !ERROR: Kind parameter '_' character in format expression ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 67b5bc2 - [DebugInfo] Check DIEnumerator bit width when comparing for equality
Author: Arthur Eubanks Date: 2022-01-04T21:59:16-08:00 New Revision: 67b5bc26bde81a60688ae5c049a001ffbc6dd614 URL: https://github.com/llvm/llvm-project/commit/67b5bc26bde81a60688ae5c049a001ffbc6dd614 DIFF: https://github.com/llvm/llvm-project/commit/67b5bc26bde81a60688ae5c049a001ffbc6dd614.diff LOG: [DebugInfo] Check DIEnumerator bit width when comparing for equality As mentioned in D106585, this causes non-determinism, which can also be shown by this test case being flaky without this patch. We were using the APSInt's bit width for hashing, but not for checking for equality. APInt::isSameValue() does not check bit width. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D115054 (cherry picked from commit 93a20ecee4b6c6618e0a8e1112f4f929d55ffcbb) Added: Modified: llvm/lib/IR/LLVMContextImpl.h llvm/unittests/IR/DebugInfoTest.cpp Removed: diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 2ae23fdc95a8a..655319eb1c99e 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -391,8 +391,9 @@ template <> struct MDNodeKeyImpl { IsUnsigned(N->isUnsigned()) {} bool isKeyOf(const DIEnumerator *RHS) const { -return APInt::isSameValue(Value, RHS->getValue()) && - IsUnsigned == RHS->isUnsigned() && Name == RHS->getRawName(); +return Value.getBitWidth() == RHS->getValue().getBitWidth() && + Value == RHS->getValue() && IsUnsigned == RHS->isUnsigned() && + Name == RHS->getRawName(); } unsigned getHashValue() const { return hash_combine(Value, Name); } diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp index 060a5c2b08bc8..17b6e54644b23 100644 --- a/llvm/unittests/IR/DebugInfoTest.cpp +++ b/llvm/unittests/IR/DebugInfoTest.cpp @@ -7,8 +7,9 @@ //===--===// #include "llvm/IR/DebugInfo.h" -#include "llvm/IR/DIBuilder.h" +#include "llvm/ADT/APSInt.h" #include "llvm/AsmParser/Parser.h" +#include "llvm/IR/DIBuilder.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/LLVMContext.h" @@ -244,4 +245,21 @@ TEST(DIBuilder, CreateSetType) { EXPECT_TRUE(isa_and_nonnull(SetType)); } +TEST(DIBuilder, DIEnumerator) { + LLVMContext Ctx; + std::unique_ptr M(new Module("MyModule", Ctx)); + DIBuilder DIB(*M); + APSInt I1(APInt(32, 1)); + APSInt I2(APInt(33, 1)); + + auto *E = DIEnumerator::get(Ctx, I1, I1.isSigned(), "name"); + EXPECT_TRUE(E); + + auto *E1 = DIEnumerator::getIfExists(Ctx, I1, I1.isSigned(), "name"); + EXPECT_TRUE(E1); + + auto *E2 = DIEnumerator::getIfExists(Ctx, I2, I1.isSigned(), "name"); + EXPECT_FALSE(E2); +} + } // end namespace ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits