[Bug c/47409] volatile struct member bug

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 30 11:39:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47409

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-30 11:38:30 UTC ---
struct s2 {
  volatile int x;
};

struct s2 s;

void foo (void) {
  s = s;
}

As said previously I think that volatile struct members are ill-defined.
The only way for the middle-end to see the volatileness in the above
s = s copy is if the frontend would make 's' volatile.  That is,
effectively make it

struct s2 {
  volatile int x;
};

typedef volatile struct s2 S;

S s;

as there is otherwise no way to mark 's' in s = s with TREE_THIS_VOLATILE
(it's the plain decl, which in the original testcase is not volatile).



More information about the Gcc-bugs mailing list