On Wed, Aug 7, 2013 at 10:34 AM, Nathan Sidwell <nat...@acm.org> wrote: > Having poked further, I find this in the testsuite: > > pr11001-strlen-2.c > --begin > register int regvar asm("%eax"); > > char * > do_copy (char *str) > { > return malloc (strlen (str) + 1); > } > --end > > Is that even meaningful? The doc's for a global reg var say: > 'Choose a register that is normally saved and restored by function calls on > your > machine, so that library routines will not clobber it.'
This is risky but meaningful, and potentially useful with asm instructions. > If one never made calls to a library unaware of the reg's global use, things > would be ok. Except if one chose a register that is used by the ABI to > return things, or by the pro/epilogue code as a scratch register. > > Should attempts to use a call_used reg as a global reg var generate an > error? No. Perhaps a warning. > Should it stop it being marked as a fixed_reg? Definitely not. Ian