[llvm-bugs] [Bug 31993] New: clang generating memcpy with source/destination overlap
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 17 05:51:16 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=31993
Bug ID: 31993
Summary: clang generating memcpy with source/destination
overlap
Product: new-bugs
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: mikael.holmen at ericsson.com
CC: llvm-bugs at lists.llvm.org
Created attachment 18001
--> https://bugs.llvm.org/attachment.cgi?id=18001&action=edit
reproducer
With
clang -S -emit-llvm tr13026.c -o tr13026.ll
we get this memcpy call in the output
call void @llvm.memcpy.p0i8.p0i8.i64(i8* bitcast (%struct.anon* @s to i8*),
i8* bitcast (%struct.anon* @s to i8*), i64 4, i32 4, i1 false)
where the dest and source arguments are the same, and thus clearly overlap.
However, in the documentation:
http://llvm.org/docs/LangRef.html#llvm-memcpy-intrinsic
it says:
"The ‘llvm.memcpy.*‘ intrinsics copy a block of memory from the source location
to the destination location, which are not allowed to overlap."
And if running lint on the output:
opt -S -lint -o tr13026.opt.ll tr13026.ll
we get a warning about it:
Undefined behavior: memcpy source and destination overlap
call void @llvm.memcpy.p0i8.p0i8.i64(i8* bitcast (%struct.anon* @s to i8*),
i8* bitcast (%struct.anon* @s to i8*), i64 4, i32 4, i1 false)
--
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/20170217/2461b3e7/attachment.html>
More information about the llvm-bugs
mailing list