blob: 83aa854485b4016244037cb1f91ad283fceaa50c [file] [log] [blame]
Peter Collingbourne49d29ed2013-10-20 21:29:32 +00001// RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %t 2>&1 | FileCheck %s
Richard Smith6ebe4512012-10-09 19:34:32 +00002
3#include <stdint.h>
4
5int main() {
6 unsigned(0x80000000) / -1;
7
Will Dietz7cbd7e52012-12-02 18:43:33 +00008 // CHECK: div-overflow.cpp:9:23: runtime error: division of -2147483648 by -1 cannot be represented in type 'int'
Richard Smith6ebe4512012-10-09 19:34:32 +00009 int32_t(0x80000000) / -1;
10}