summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr24665.C
blob: 646642c4986f60e14a66596275b83a25cdcff616 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// { dg-do compile }
// { dg-options "-O2" }

typedef unsigned long T;
typedef volatile T* const hwreg_t;
struct RegisterLayout
{
    T intmask;
};
struct Controller_t
{
    Controller_t();
    inline void
    disableInterrupt()
    {
        *mpMaskRegister = 0;
    };
    static hwreg_t mpMaskRegister;
};

extern char SimulatedRegisters[];

hwreg_t Controller_t::mpMaskRegister
  = &(reinterpret_cast<volatile RegisterLayout*>(SimulatedRegisters))->intmask;

Controller_t::Controller_t()
{
    disableInterrupt();
}