public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/61086] New: ubsan detects undefined behaviour in the standard library
@ 2014-05-06 20:29 chris at detrino dot org
  2014-05-06 21:10 ` [Bug libstdc++/61086] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: chris at detrino dot org @ 2014-05-06 20:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61086

            Bug ID: 61086
           Summary: ubsan detects undefined behaviour in the standard
                    library
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chris at detrino dot org

The following program compiled with clang++ -fsanitize=undefined reveals
undefined behavior.

Program:

#include <array>
#include <vector>

int main()
{
    std::vector<int> v;
    std::array<int, 2> array{{0, 1}};
    v.insert(v.end(), array.begin(), array.end());
}

Errors:

/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/stl_iterator.h:745:26:
runtime error: reference binding to null pointer of type 'typename
_PTraits::element_type' (aka 'int')
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/ptr_traits.h:169:31:
runtime error: reference binding to null pointer of type 'typename
__ptrtr_not_void<element_type>::__type' (aka 'int')
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/move.h:136:31:
runtime error: reference binding to null pointer of type 'int'


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-07 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 20:29 [Bug libstdc++/61086] New: ubsan detects undefined behaviour in the standard library chris at detrino dot org
2014-05-06 21:10 ` [Bug libstdc++/61086] " redi at gcc dot gnu.org
2014-05-07 11:49 ` [Bug libstdc++/61086] [4.9/4.10 Regression] " redi at gcc dot gnu.org
2014-05-07 14:44 ` redi at gcc dot gnu.org
2014-05-07 15:05 ` redi at gcc dot gnu.org
2014-05-07 15:07 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).