[llvm-bugs] [Bug 26000] New: [WinEH] asserting loop optimizations with captured variables
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jan 2 09:04:14 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26000
Bug ID: 26000
Summary: [WinEH] asserting loop optimizations with captured
variables
Product: clang
Version: trunk
Hardware: PC
OS: Windows XP
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: r.sagitario at gmx.de
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Compile this code with "clang -m32 -fexceptions -c -O":
struct string
{
string(const char*s);
const char* ptr;
};
bool adEq2(string& s1);
void checkContent(string s)
{
string old = s;
auto fail = [&]()
{
s = old;
};
try
{
while (s.ptr != 0)
{
old = s;
if (adEq2(s)) { }
}
}
catch(int e)
{
fail();
}
}
Result:
Assertion failed: Val && "isa<> used on a null pointer", file
C:\s\d\ldc\llvm\include\llvm/Support/Casting.h, line 95
It does not happen without optimizations or when compiling with -m64.
Bugpoint reports a broken function after the -licm pass, here is the IR to
reproduce:
; ModuleID = 'bugpoint-reduced-instructions.bc'
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc18.0.0"
%rtti.TypeDescriptor2.0.2.4.6.8.22 = type { i8**, i8*, [3 x i8] }
%struct.string.1.3.5.7.9.23 = type { i8* }
@"\01??_7type_info@@6B@" = external constant i8*
@"\01??_R0H at 8" = external global %rtti.TypeDescriptor2.0.2.4.6.8.22
define void @"\01?checkContent@@YAXUstring@@@Z"(%struct.string.1.3.5.7.9.23*
byval align 4 %s) #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to
i8*) {
entry:
br label %while.cond
while.cond: ; preds = %while.body, %entry
%0 = ptrtoint i8* undef to i32
br i1 undef, label %try.cont, label %while.body
while.body: ; preds = %while.cond
%call = invoke zeroext i1
@"\01?adEq2@@YA_NAAUstring@@@Z"(%struct.string.1.3.5.7.9.23* nonnull
dereferenceable(4) %s)
to label %while.cond unwind label %catch.dispatch
catch.dispatch: ; preds = %while.body
%1 = catchswitch within none [label %catch] unwind to caller
catch: ; preds = %catch.dispatch
%2 = catchpad within %1 [%rtti.TypeDescriptor2.0.2.4.6.8.22* @"\01??_R0H at 8",
i32 0, i32* undef]
store i32 %0, i32* undef, align 4
catchret from %2 to label %try.cont
try.cont: ; preds = %catch, %while.cond
ret void
}
; Function Attrs: argmemonly nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly,
i32, i32, i1) #1
declare zeroext i1 @"\01?adEq2@@YA_NAAUstring@@@Z"(%struct.string.1.3.5.7.9.23*
dereferenceable(4)) #0
declare i32 @__CxxFrameHandler3(...)
attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false"
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="pentium4"
"target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #1 = { argmemonly nounwind }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.8.0 "}
--
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/20160102/d6dd9374/attachment.html>
More information about the llvm-bugs
mailing list