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

            Bug ID: 85164
           Summary: poly-int.h:845:5: runtime error: signed integer
                    overflow
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For the following C code, in file bug425b.c

a[];
b;
c() {
  unsigned long d;
  b = a[d - 1 >> 3];
}

Compiled by gcc trunk revision 259004, compiled with undefined behaviour
sanitizer, does this:

$ ~/gcc/results/bin/gcc -c -O2 -w bug425b.c
../../trunk/gcc/poly-int.h:845:5: runtime error: signed integer overflow:
9223372036854775804 + 4 cannot be represented in type 'long int'
$ ~/gcc/results/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/dcb/gcc/results/bin/gcc
COLLECT_LTO_WRAPPER=/home/dcb/gcc/results.259004.ubsan/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../trunk/configure --prefix=/home/dcb/gcc/results.259004.ubsan
--with-build-config=bootstrap-ubsan --disable-multilib --disable-werror
--enable-checking=df,extra,fold,rtl,yes --enable-languages=c,c++,fortran
Thread model: posix
gcc version 8.0.1 20180402 (experimental) (GCC) 
$

Reply via email to