strub: enable conditional support
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr103266.C
blobd5c13f5097972d3dab1ad6710c0df3f9e457464c
1 // { dg-do run }
2 /* { dg-additional-options "-std=c++14" } */
3     typedef unsigned int u32;
4     typedef unsigned char u8;
6     static u32 pu8to32(const u8 * p8) __attribute__((noinline));
7     static u32 pu8to32(const u8 * p8) {
8       u32 v;
9     
10       __builtin_memcpy(&v, __builtin_assume_aligned(p8, 1), sizeof(u32));
11     
12       return v;
13     }
14     
15     int main(void) {
16       // dse1 throws this store away
17       u8 d[sizeof(u32)] = {
18           0x07, 0x00, 0x00, 0x07,
19       };
20     
21       if (pu8to32(d) != 0x07000007)
22         __builtin_trap();
23     }