[llvm-bugs] [Bug 41276] New: Invalid address space cast in C++17 mode (CastConsistency assertion failure)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 28 08:25:29 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: bruno-llvm at defraine.net
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190328/703941d6/attachment.html>


More information about the llvm-bugs mailing list