Gcc 9 porting notes/asm volatile

From Gentoo Wiki
Jump to: navigation, search

The problem

Starting from g++-9 (and for g++-8.3.0) GCC will reject the asm volatile toplevel constructs:

  asm volatile("some thing");
test.cc:1:5: error: expected ‘(’ before ‘volatile’
 asm volatile("some thing ");
     ^~~~~~~~
     (

The fix

The fix is simple: just drop volatile. There is no defined symbol ordering in object file anyway:

  asm ("some thing ");

Links and examples

See upstream discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89585