------- Comment #3 from manu at gcc dot gnu dot org 2008-02-26 20:14 ------- (In reply to comment #2) > You can use > > /* { dg-add-options register } */ > > register int * volatile x asm REGISTER; /* { dg-warning "optimization may > eliminate reads and/or writes to register variables" } */ > > You need to define add_options_for_register to add proper > -DREGITSR=. >
That seems too complicated for a simple diagnostics test. Moreover, I couldn't find a single example of that in the testsuite. Why not simply? /* { dg-do compile } */ /* { dg-options "-Wall" } */ #ifdef __i386__ register unsigned int volatile reg __asm ("esi"); /* { dg-warning "optimization may eliminate reads and/or writes to register variables" } */ #elif defined __x86_64__ register int * volatile x __asm ("r13"); /* { dg-warning "optimization may eliminate reads and/or writes to register variables" } */ #else unsigned int reg; #endif I can only test in x86_64-unknown-linux-gnu. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35382