https://bugs.llvm.org/show_bug.cgi?id=41276

            Bug ID: 41276
           Summary: Invalid address space cast in C++17 mode
                    (CastConsistency assertion failure)
           Product: clang
           Version: 8.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Hi,

The following code triggers an assertion failure in clang-8 when compiling in
C++17 mode:

$ cat test.cpp

struct MyType {
    MyType(int i): i(i) { }
    int i;
};

MyType __attribute__((address_space(10))) m = 123;

$ clang -S -std=c++17 test.cpp

clang/lib/AST/Expr.cpp:1685: bool clang::CastExpr::CastConsistency() const:
Assertion `!Ty.isNull() && !SETy.isNull() && Ty.getAddressSpace() !=
SETy.getAddressSpace()' failed.

Godbolt segfault: https://godbolt.org/z/P4GXmF

This issue seems to have been introduced by this commit:

https://github.com/llvm/llvm-project/commit/04307941e2b16cd78347b90418204d84b584c49e

I think the old behavior was to create a CK_NoOp cast, while
PerformQualificationConversion will now create a CK_AddressSpaceConversion, but
this does not seem warranted?

Regards,
Bruno

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to