comparison gcc/testsuite/g++.dg/torture/pr83283.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // PR tree-optimization/83283
2 // { dg-do run }
3 // { dg-additional-options "-std=c++11" }
4
5 enum E : unsigned char { X = 0, Y = 1 };
6
7 void __attribute__((noinline))
8 foo (E *v, int size)
9 {
10 for (int i = 0; i < size; ++i)
11 {
12 const bool b = (v[i] == E::Y);
13 v[i] = static_cast<E>(static_cast<unsigned char>(b));
14 }
15 }
16
17 int
18 main ()
19 {
20 constexpr int items = 32;
21 E vals[items] = {X};
22 vals[3] = Y;
23 foo (vals, items);
24 if (vals[3] != 1)
25 __builtin_abort ();
26 }