[LLVMbugs] [Bug 23190] New: MSPropertyDeclRefExpr crashes with noexcept

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 10 08:49:03 PDT 2015


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

            Bug ID: 23190
           Summary: MSPropertyDeclRefExpr crashes with noexcept
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron at aaronballman.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Use of an MSPropertyDeclRefExpr and a noexcept expression causes a failed
assertion. e.g.)

struct S {
  __declspec(property(get=getter)) int x;

  int getter() noexcept(false) { throw "hahaha"; }
};

S s;
int v = noexcept(s.x);

Yields:

E:\llvm\2013>clang -cc1 -fsyntax-only -std=c++11 "E:\Aaron
Ballman\Desktop\test.
cpp"
E:\Aaron Ballman\Desktop\test.cpp:11:18: warning: expression with side effects
h
as no effect in an unevaluated context
int v = noexcept(s.x);
                 ^
Invalid class for expression
UNREACHABLE executed at
E:\llvm\llvm\tools\clang\lib\Sema\SemaExceptionSpec.cpp:
1149!
0x01F280B9 (0x00000016 0x470775EB 0x06AEC77C 0x06AEC708), HandleAbort() + 0x9
by
tes(s), e:\llvm\llvm\lib\support\windows\signals.inc, line 290
0x0F5FF7F9 (0x00000016 0x01F280B0 0x06AEC70C 0x01F35BB9), raise() + 0x2B9
bytes(
s)
0x0F60B284 (0x06AEE608 0x06AEC77C 0x035B11EC 0x058D9234), abort() + 0x34
bytes(s
)
0x01F35BB9 (0x058D9234 0x058D91FC 0x0000047D 0x06AEC7B8),
llvm::llvm_unreachable
_internal() + 0x89 bytes(s), e:\llvm\llvm\lib\support\errorhandling.cpp, line
11
7 + 0x8 byte(s)
0x035B11EC (0x006D7EB0 0x06AED768 0xCCCCCCCC 0xCCCCCCCC),
clang::Sema::canThrow(
) + 0x55C bytes(s), e:\llvm\llvm\tools\clang\lib\sema\semaexceptionspec.cpp,
lin
e 1158
0x032E845C (0x06AEC824 0x000000B1 0x006D7EB0 0x000000BD),
clang::Sema::BuildCXXN
oexceptExpr() + 0x7C bytes(s),
e:\llvm\llvm\tools\clang\lib\sema\semaexprcxx.cpp
, line 5800 + 0xC byte(s)
0x032E83C6 (0x06AEC824 0x000000B1 0x000000B9 0x006D7EB0),
clang::Sema::ActOnNoex
ceptExpr() + 0x26 bytes(s), e:\llvm\llvm\tools\clang\lib\sema\semaexprcxx.cpp,
l
ine 5807 + 0x18 byte(s)
0x02F7E67D (0x06AED798 0x00000000 0x00000000 0x06AED7A7),
clang::Parser::ParseCa
stExpression() + 0x241D bytes(s),
e:\llvm\llvm\tools\clang\lib\parse\parseexpr.c
pp, line 1240 + 0x4F byte(s)
0x02F7ED89 (0x06AED7CC 0x00000000 0x00000000 0x00000000),
clang::Parser::ParseCa
stExpression() + 0x39 bytes(s),
e:\llvm\llvm\tools\clang\lib\parse\parseexpr.cpp
, line 441
0x02F7B539 (0x06AEDA08 0x00000000 0x00716A58 0x06AEDAE8),
clang::Parser::ParseAs
signmentExpression() + 0x99 bytes(s),
e:\llvm\llvm\tools\clang\lib\parse\parseex
pr.cpp, line 170
0x02F6A720 (0x06AEDA08 0x06AEE228 0x06AEE608 0x00000000),
clang::Parser::ParseIn
itializer() + 0x30 bytes(s),
e:\llvm\llvm\tools\clang\include\clang\parse\parser
.h, line 1521 + 0xE byte(s)
0x02F554A1 (0x06AEDD98 0x06AEDB4C 0x00000000 0x06AEE2A8),
clang::Parser::ParseDe
clarationAfterDeclaratorAndAttributes() + 0x501 bytes(s),
e:\llvm\llvm\tools\cla
ng\lib\parse\parsedecl.cpp, line 1958
0x02F54A59 (0x06AEE5AC 0x06AEE2E0 0x00000000 0x00000000),
clang::Parser::ParseDe
clGroup() + 0x6B9 bytes(s), e:\llvm\llvm\tools\clang\lib\parse\parsedecl.cpp,
li
ne 1743 + 0x1F byte(s)
0x02F36455 (0x06AEE5AC 0x06AEE5D4 0x06AEE2E0 0x00000003),
clang::Parser::ParseDe
clOrFunctionDefInternal() + 0x2D5 bytes(s),
e:\llvm\llvm\tools\clang\lib\parse\p
arser.cpp, line 893 + 0x16 byte(s)
0x02F36109 (0x06AEE5AC 0x06AEE5D4 0x00000000 0x00000003),
clang::Parser::ParseDe
clarationOrFunctionDefinition() + 0x89 bytes(s),
e:\llvm\llvm\tools\clang\lib\pa
rse\parser.cpp, line 909 + 0x1B byte(s)
0x02F35B4C (0x06AEE5AC 0x06AEE5D4 0x00000000 0x06AEE68C),
clang::Parser::ParseEx
ternalDeclaration() + 0x90C bytes(s),
e:\llvm\llvm\tools\clang\lib\parse\parser.
cpp, line 767 + 0x16 byte(s)
0x02F32695 (0x06AEE644 0x06AEE734 0x06AEE69C 0x00716A58),
clang::Parser::ParseTo
pLevelDecl() + 0x205 bytes(s), e:\llvm\llvm\tools\clang\lib\parse\parser.cpp,
li
ne 569 + 0x12 byte(s)
0x02F30968 (0x00700608 0x00000000 0x00000000 0x06AEE6B8), clang::ParseAST() +
0x
1B8 bytes(s), e:\llvm\llvm\tools\clang\lib\parse\parseast.cpp, line 144 + 0xC
by
te(s)
0x021D3D21 (0x06AEE6E0 0xCCCCCCCC 0xCCCCCCCC 0xCCCCCCCC),
clang::ASTFrontendActi
on::ExecuteAction() + 0x101 bytes(s),
e:\llvm\llvm\tools\clang\lib\frontend\fron
tendaction.cpp, line 538 + 0x30 byte(s)
0x021D390E (0x06AEE7D8 0x00000000 0xCCCCCCCC 0xCCCCCCCC),
clang::FrontendAction:
:Execute() + 0x7E bytes(s),
e:\llvm\llvm\tools\clang\lib\frontend\frontendaction
.cpp, line 439 + 0xF byte(s)
0x0218ECA1 (0x006A6890 0x06AEECE0 0x00000000 0xCCCCCCCC),
clang::CompilerInstanc
e::ExecuteAction() + 0x2A1 bytes(s),
e:\llvm\llvm\tools\clang\lib\frontend\compi
lerinstance.cpp, line 808
0x022E506E (0x0069A948 0x06AEFA90 0xCCCCCCCC 0xCCCCCCCC),
clang::ExecuteCompiler
Invocation() + 0x30E bytes(s),
e:\llvm\llvm\tools\clang\lib\frontendtool\execute
compilerinvocation.cpp, line 222 + 0x11 byte(s)
0x00B6BC22 (0x06AEF678 0x00000003 0x006AB488 0x00AA137F), cc1_main() + 0x302
byt
es(s), e:\llvm\llvm\tools\clang\tools\driver\cc1_main.cpp, line 110 + 0xE
byte(s
)
0x00B59138 (0x06AEF670 0x00000005 0x006AB492 0x00000000), ExecuteCC1Tool() +
0x7
8 bytes(s), e:\llvm\llvm\tools\clang\tools\driver\driver.cpp, line 369 + 0x2B
by
te(s)
0x00B594DA (0x00000005 0x00697CE8 0x00694928 0x7F3A4262), main() + 0x2FA
bytes(s
), e:\llvm\llvm\tools\clang\tools\driver\driver.cpp, line 415 + 0x33 byte(s)
0x03E98E49 (0x06AEFAF4 0x766A338A 0x7EFDE000 0x06AEFB34), __tmainCRTStartup() +
0x199 bytes(s), f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c, line 626 + 0x19
byte
(s)
0x03E98F8D (0x7EFDE000 0x06AEFB34 0x77199F72 0x7EFDE000), mainCRTStartup() +
0xD
 bytes(s), f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c, line 466
0x766A338A (0x7EFDE000 0x4F1BE5C2 0x00000000 0x00000000), BaseThreadInitThunk()
+ 0x12 bytes(s)
0x77199F72 (0x03E98F80 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeException
Chain() + 0x63 bytes(s)
0x77199F45 (0x03E98F80 0x7EFDE000 0x00000000 0x00000000),
RtlInitializeException
Chain() + 0x36 bytes(s)

It seems that the canThrow() function has an llvm_unreachable that is actually
reachable. I believe the correct fix is to look through to the getter or setter
function the property represents to see if it throws or not. However, it seems
that we claim PseudoObjectExprClass never throws (with a FIXME), so a temporary
solution may be to move the MSPropertyRefExprClass case to be with the pseudo
object one.

-- 
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/20150410/532638c4/attachment.html>


More information about the llvm-bugs mailing list