-fsanitize=nonnull-attribute failing on empty container

Lars Gullik Bjønnes larsbj@gullik.org
Thu May 28 17:26:00 GMT 2015


Is this is a known problem?

-------
#include <vector>

int main()
{
   std::vector<unsigned> a;
   std::vector<unsigned> b;
   return a == b;
}
---------

$ g++ -fsanitize=nonnull-attribute empty_vectors.cpp
$ /a.out
usr/include/c++/5.1.1/bits/stl_algobase.h:825:28: runtime error: null
pointer passed as argument 1, which is declared to never be null
/usr/include/c++/5.1.1/bits/stl_algobase.h:825:28: runtime error: null
pointer passed as argument 2, which is declared to never be null

$ g++ --version
g++ (GCC) 5.1.1 20150422 (Red Hat 5.1.1-1)
(fc22)

I got the same with:
$ /opt/gcc/gcc-5/bin/g++ --version
g++ (GCC) 5.1.1

-- 
        Lgb



More information about the Gcc-help mailing list