Skip to content

Commit fa960a2

Browse files
committed
tests: cover 32-bit enum edge cases
1 parent cf6c6f1 commit fa960a2

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %ispc %s -o %t.o --target=host
2+
3+
// Regression test for allowing 32-bit enum values with the high bit set.
4+
5+
enum Flags {
6+
FLAG_HIGH_BIT = 0x80000000,
7+
FLAG_ALL = 0xffffffff
8+
};
9+
10+
export uniform int use_enum_values() {
11+
uniform int a = (int)FLAG_HIGH_BIT;
12+
uniform int b = (int)FLAG_ALL;
13+
return a + b;
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: not %{ispc} --nowrap --nostdlib --target=host %s -o - 2>&1 | FileCheck %s
2+
3+
// CHECK: Error: Enumerator value must be representable with a 32-bit integer.
4+
5+
enum TooBig {
6+
TOO_BIG = 0x100000000
7+
};

0 commit comments

Comments
 (0)