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

            Bug ID: 85508
           Summary: runtime error in config/i386/i386.c
           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 this C code:

typedef char a;
typedef b;
c;
d(e) {
  for (;; f()) {
    a *g;
    b h;
    for (h = 0; h < 27; h++)
      for (e = 0; e <= 26; ++e)
        *g &= c;
  }
}

compiled by a ubsan version of recent gcc trunk, I get this:

$ ~/gcc/results/bin/gcc -c -O3 -w bug431.c
../../trunk/gcc/config/i386/i386.c:43197:33: runtime error: left shift of
negative value -1
$ ~/gcc/results/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/dcb/gcc/results/bin/gcc
COLLECT_LTO_WRAPPER=/home/dcb/gcc/results.259553.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.259553.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 20180422 (experimental) (GCC)
$

File ../../trunk/gcc/config/i386/i386.c line 43197 is

         x = gen_int_mode (INTVAL (x) << 8, HImode);

Reply via email to