<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - No lifetime markers for temp object used to call conversion operator"
href="https://bugs.llvm.org/show_bug.cgi?id=34353">34353</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>No lifetime markers for temp object used to call conversion operator
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vitalybuka@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Check test_a (BAD) and test_b (GOOD) below.
struct B {
B() : p('B') {}
char p;
};
struct C {
const char* p;
explicit C(const char* c) : p(c) { }
C(const B& b) : p(&b.p) { } // NOLINT
};
struct A {
char p;
explicit A() : p('C') { }
const operator C() const {
return C(&p);
}
};
volatile char r;
void test_a() {
// conversion operator, temp object will have not lifetime markers
C s = A();
r = *s.p;
}
void test_b() {
// Copy constructor, temp object will have lifetime markers
C s = B();
r = *s.p;
}
*** IR Dump Before Module Verifier ***
; Function Attrs: nounwind uwtable
define void @_Z6test_av() #0 !dbg !7 {
entry:
%s = alloca %struct.C, align 8
%tmp = alloca %struct.A, align 1
%0 = bitcast %struct.C* %s to i8*, !dbg !9
call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #3, !dbg !9
call void @_ZN1AC2Ev(%struct.A* %tmp), !dbg !10
%call = call i8* @_ZNK1Acv1CEv(%struct.A* %tmp), !dbg !10
%coerce.dive = getelementptr inbounds %struct.C, %struct.C* %s, i32 0, i32 0,
!dbg !10
store i8* %call, i8** %coerce.dive, align 8, !dbg !10
%p = getelementptr inbounds %struct.C, %struct.C* %s, i32 0, i32 0, !dbg !11
%1 = load i8*, i8** %p, align 8, !dbg !11, !tbaa !12
%2 = load i8, i8* %1, align 1, !dbg !17, !tbaa !18
store volatile i8 %2, i8* @r, align 1, !dbg !19, !tbaa !18
%3 = bitcast %struct.C* %s to i8*, !dbg !20
call void @llvm.lifetime.end.p0i8(i64 8, i8* %3) #3, !dbg !20
ret void, !dbg !20
}
*** IR Dump Before Module Verifier ***
; Function Attrs: nounwind uwtable
define void @_Z6test_bv() #0 !dbg !25 {
entry:
%s = alloca %struct.C, align 8
%ref.tmp = alloca %struct.B, align 1
%0 = bitcast %struct.C* %s to i8*, !dbg !26
call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #3, !dbg !26
%1 = bitcast %struct.B* %ref.tmp to i8*, !dbg !27
call void @llvm.lifetime.start.p0i8(i64 1, i8* %1) #3, !dbg !27
call void @_ZN1BC2Ev(%struct.B* %ref.tmp), !dbg !27
call void @_ZN1CC2ERK1B(%struct.C* %s, %struct.B* dereferenceable(1)
%ref.tmp), !dbg !27
%2 = bitcast %struct.B* %ref.tmp to i8*, !dbg !28
call void @llvm.lifetime.end.p0i8(i64 1, i8* %2) #3, !dbg !28
%p = getelementptr inbounds %struct.C, %struct.C* %s, i32 0, i32 0, !dbg !29
%3 = load i8*, i8** %p, align 8, !dbg !29, !tbaa !30
%4 = load i8, i8* %3, align 1, !dbg !33, !tbaa !11
store volatile i8 %4, i8* @r, align 1, !dbg !34, !tbaa !11
%5 = bitcast %struct.C* %s to i8*, !dbg !35
call void @llvm.lifetime.end.p0i8(i64 8, i8* %5) #3, !dbg !35
ret void, !dbg !35
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>