[llvm-bugs] [Bug 47869] New: __clang_cuda_runtime_wrapper.h __THROW macro redefinition inconsistent with libc

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 15 17:59:57 PDT 2020


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

            Bug ID: 47869
           Summary: __clang_cuda_runtime_wrapper.h __THROW macro
                    redefinition inconsistent with libc
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: CUDA
          Assignee: unassignedclangbugs at nondot.org
          Reporter: daravi at alumni.ubc.ca
                CC: llvm-bugs at lists.llvm.org

Trying to build TensorFlow with LLVM trunk, I arrived at this error

```
++ compilation of rule '//tensorflow/core/kernels/rnn:gru_ops_gpu' failed (Exit
1)
In file included from <built-in>:1:
In file included from
/opt/llvm-master/lib/clang/12.0.0/include/__clang_cuda_runtime_wrapper.h:211:
In file included from /opt/llvm-master/bin/../include/c++/v1/string.h:60:
In file included from /usr/include/string.h:431:
In file included from /usr/include/strings.h:144:
/usr/include/bits/strings_fortified.h:23:8: error: exception specification in
declaration does not match previous declaration
__NTH (bcopy (const void *__src, void *__dest, size_t __len))
       ^
/usr/include/strings.h:38:13: note: previous declaration is here
extern void bcopy (const void *__src, void *__dest, size_t __n)
```

Looking at those files I see that the macros are defined in
`/usr/include/sys/cdefs.h`. This file defines __THROW, __NTH and __NTHNL with
consistent exception specifier as they are used to declare and define the same
functions. However `__clang_cuda_runtime_wrapper.h` re-defines only the
`__THROW` macro:

```
// __THROW is redefined to be empty by device_functions_decls.h in CUDA.
Clang's
// counterpart does not do it, so we need to make it empty here to keep
// following CUDA includes happy.
#undef __THROW
#define __THROW
```

I think the other two macros should also be cleared to avoid breaking the
exception specifier consistency in libc. If you agree please let me know and I
will be glad to contribute the fix.

-- 
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/20201016/13e6ac4f/attachment.html>


More information about the llvm-bugs mailing list