Given the following code: volatile int16_t foo; x = (int32_t)foo;
The above cast should almost certainly have been (volatile int32_t), I see no obvious case where someone would want to cast away the volatile attribute. I suggest that a cast that drops a volatile attribute from a variable should cause a warning. (Epiphany occurred at the end of a frustrating day, was using gcc 4.2.2 targeting an AVR) -- Summary: Casting from a volatile type to a non-volatile type should cause a warning Product: gcc Version: 4.2.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcc-david at tulloh dot id dot au http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35069