[llvm-bugs] [Bug 40161] New: custom allocator and __pad_and_output from v1/locale

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 26 08:50:09 PST 2018


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

            Bug ID: 40161
           Summary: custom allocator and __pad_and_output from v1/locale
           Product: libc++
           Version: 6.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: moko at design.ru
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

In our code we are using basic_stringstream with custom allocator:

typedef std::basic_stringstream<char, std::char_traits<char>,
gc_allocator<char> > pa_stringstream;
typedef std::basic_string<char, std::char_traits<char>, gc_allocator<char> >
pa_string;

And we have checks for default new operator usage in our code:

void *new_disabled();
inline void *operator new[] (std::size_t){ return new_disabled(); }
inline void *operator new(std::size_t){ return new_disabled(); }

And with FreeBSD clang version 6.0.0 we get the following linker error:

table.C:(.text._ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_[_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_]+0x9d):
undefined reference to `new_disabled()'

The issue is related to the following commit:
https://github.com/llvm-mirror/libcxx/commit/a585de645cccf1b8772c7efc8b77b6c1044ffe2c
Where the declaration is without allocator: basic_string<_CharT, _Traits>
__sp(__ns, __fl);
And if we simply comment out "if (__ns > 0)" fragment, the code compiles fine.

Note: there were not link error with previous clang (FreeBSD clang version
3.8.0), where the "locale" code is the same.
But may be the whole method was optimized out then.

If required, our full source code is available at
https://github.com/artlebedev/parser3/blob/master/src/classes/table.C

-- 
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/20181226/c574ece1/attachment.html>


More information about the llvm-bugs mailing list