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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|g++ bug caused by r260621   |g++ bug caused by
                   |                            |r9-595-g955da5e5443724cb
   Last reconfirmed|                            |2022-09-20
     Ever confirmed|0                           |1
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
$ g++ pr106974.C -fsanitize=undefined && ./a.out
pr106974.C: In instantiation of ‘const NumType&
TestVector<NumType>::operator[](int) const [with NumType = unsigned int]’:
pr106974.C:24:24:   required from here
pr106974.C:16:34: warning: returning reference to temporary
[-Wreturn-local-addr]
   16 |       return shard_index_[0].data[0];
      |              ~~~~~~~~~~~~~~~~~~~~^
pr106974.C:16:36: runtime error: reference binding to null pointer of type
'const unsigned int'
pr106974.C:24:11: runtime error: load of null pointer of type 'const unsigned
int'
Segmentation fault (core dumped)

while clang is fine:

$ clang++ pr106974.C -fsanitize=undefined && ./a.out
0

Really started with r9-595-g955da5e5443724cb.

Reply via email to