https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94747

            Bug ID: 94747
           Summary: Undefined behavior: integer overflow in
                    libsupc++/dyncast.cc
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hiraditya at msn dot com
  Target Milestone: ---

Integer overflow reported by asan with the following stack trace. If this is
not 
sufficient I can try to provide a repro

gcc/7.x/libstdc++-v3/libsupc++/dyncast.cc:53:11: runtime error: negation of 16
cannot be represented in type 'unsigned long'
>     #0 in __dynamic_cast gcc/7.x/libstdc++-v3/libsupc++/dyncast.cc:53
>     #1 in bool std::has_facet<std::ctype<char> >(std::locale const&) 
> gcc/7.x/.../bits/locale_classes.tcc:110
>     #2 in std::basic_ios<char, std::char_traits<char> 
> >::_M_cache_locale(std::locale const&) gcc/7.x/.../bits/basic_ios.tcc:159
>     #3 in std::basic_ios<char, std::char_traits<char> 
> >::init(std::basic_streambuf<char, std::char_traits<char> >*) 
> gcc/7.x/.../bits/basic_ios.tcc:132
>     #4 in std::basic_ostream<char, std::char_traits<char> 
> >::basic_ostream(std::basic_streambuf<char, std::char_traits<char> >*) 
> gcc/7.x/.../ostream:85
>     #5 in std::ios_base::Init::Init() 
> gcc/7.x/libstdc++-v3/src/c++98/ios_init.cc:91
>     #6 in __cxx_global_var_init gcc/7.x/.../iostream:74

Reply via email to