Accesses to bitfields must, of course, not be optimized away. This is currently not the case. Add a testcase for it. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- validation/optim/volatile-bitfield.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 validation/optim/volatile-bitfield.c diff --git a/validation/optim/volatile-bitfield.c b/validation/optim/volatile-bitfield.c new file mode 100644 index 000000000..c28efb09a --- /dev/null +++ b/validation/optim/volatile-bitfield.c @@ -0,0 +1,17 @@ +struct s { + int f:3; +}; + +void foo(volatile struct s *p) +{ + p->f; +} + +/* + * check-name: volatile-bitfield + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: load\\. + */ -- 2.18.0