Re: -fsanitize=nonnull-attribute failing on empty container

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28 May 2015 at 18:26, Lars Gullik Bjønnes wrote:
> Is this is a known problem?

No, I don't think so.

At a guess, we're dispatching to memcmp for trivial types, but
shouldn't be doing that with null pointers.


> -------
> #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





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux