diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/pr24665.C')
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr24665.C | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/pr24665.C b/gcc/testsuite/g++.dg/opt/pr24665.C new file mode 100644 index 000000000..646642c49 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr24665.C @@ -0,0 +1,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(); +} |