[cfarm-users] GCC 8.2 UBsan and runtime error: signed integer overflow

Jeffrey Walton noloader at gmail.com
Tue Nov 27 22:34:52 CET 2018


On Tue, Nov 27, 2018 at 3:51 PM Jeffrey Walton <noloader at gmail.com> wrote:
>
> I've got some self tests failing on PowerPC with GCC 8.2. The program
> was compiled with -O1 and -fsanitize=undefined. The program uses
> Altivec. A sample finding is shown below.
>
> ppc_simd.h:965 is a vec_add, and it happens on a unsigned int vector.
> We don't use signed vector types. I don't believe overflow can happen
> and the algorithm depends on unsigned wrap.

In case it matters:

gcc135:~$ /opt/at12.0/bin/c++ --version
c++ (GCC) 8.2.1 20180813 (Advance-Toolchain-at12.0) [revision 263510]

And a reproducer does not reproduce:

$ cat test.cxx
#include <altivec.h>
#undef vector
#undef pixel
#undef bool

typedef __vector unsigned int uint32x4_p;

int main(int argc, char* argv[])
{
  uint32x4_p a = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
  uint32x4_p b = { 2, 2, 2, 2};

  uint32x4_p c = vec_add(a, b);

  return 0;
}


More information about the cfarm-users mailing list