[llvm-bugs] [Bug 41390] New: _FORTIFY_SOURCE and optimization(like -O1, -O2, etc.) prevents CUDA compilation
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 5 01:29:22 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41390
Bug ID: 41390
Summary: _FORTIFY_SOURCE and optimization(like -O1, -O2, etc.)
prevents CUDA compilation
Product: clang
Version: trunk
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: CUDA
Assignee: unassignedclangbugs at nondot.org
Reporter: kazukuro0824 at gmail.com
CC: llvm-bugs at lists.llvm.org
#include <stdio.h>
int main()
{
printf("test\n");
}
This code can't be compiled when you run Clang like below:
$ clang -x cuda -O2 -D_FORTIFY_SOURCE=1 -c test.cu.cc
That's because string_fortified.h, included from string.h, tries to re-declare
some built-in functions. (See also
https://sourceware.org/git/?p=glibc.git;a=blob;f=string/string.h;h=c38eea971f4396c678598f51602082318ec5349d;hb=HEAD#l494)
So, I think __clang_cuda_runtime_wrapper.h:216 should be reconsidered.
For example:
#include <string.h>
to
#if defined(__fortify_function)
#define __tmp_value __fortify_function
#undef __fortify_function
#include <string.h>
#define __fortify_function __tmp_value
#undef __tmp_value
#else
#include <string.h>
#endif
--
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/20190405/0e3ec0a1/attachment.html>
More information about the llvm-bugs
mailing list