[llvm-bugs] [Bug 36343] New: Invalid runtime error

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 11 16:26:54 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36343

            Bug ID: 36343
           Summary: Invalid runtime error
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tydeman at tybor.com
                CC: llvm-bugs at lists.llvm.org

/*
 * Invalid runtime error: load of bad bool value.
 * Using clang 5.0.1-1 on 64-bit Fedora Linux 27 on Intel core i5

# flags common to both compiler and linker
export CLFLAGS="-fsanitize=memory -fsanitize=undefined
-fno-sanitize=float-cast-overflow -fno-sanitize=float-divide-by-zero"

# flags for compiler
export CFLAGS="-std=c1x -m64 -mfpmath=sse -msse2 -O0 -fno-fast-math -pedantic
-fmath-errno"

 */

#include <stdbool.h>    /* bool */
#include <complex.h>    /* I */

static float complex f2cx;
static struct bit2 {
  unsigned int uibf : 7;
    signed int sibf : 7;
 /*plain*/ int pibf : 7;
          bool bobf : 1;
  unsigned char after[16];
} bits
= {1u,1,1,(bool)1,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};

int main(void){
  struct bit2 res;

  res.bobf = (bool)1;
  f2cx = 1.5f + I*1.5f;
  res.bobf = bits.bobf += f2cx; /* incorrect error here */

  return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180212/d43ee707/attachment.html>


More information about the llvm-bugs mailing list