diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2011-05-16 14:16:22 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2011-05-16 14:16:22 +0000 |
commit | f24a5190c25a90ec8734ce62b68c081681a314fe (patch) | |
tree | bff378566d96eca2b82352d068ba987e3a19278a | |
parent | 3066f593a88b82882330dce0f3c1bd5e262974e1 (diff) | |
download | gcc-f24a5190c25a90ec8734ce62b68c081681a314fe.zip gcc-f24a5190c25a90ec8734ce62b68c081681a314fe.tar.gz gcc-f24a5190c25a90ec8734ce62b68c081681a314fe.tar.bz2 |
re PR target/45099 ([avr] Warning could be issued for use of register variables that will fail.)
PR target/45099
* config/avr/avr.c (avr_function_arg_advance): Error if a fixed
register is needed for a function argument.
From-SVN: r173791
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 084fb0e..b8af4fb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-16 Georg-Johann Lay <avr@gjlay.de> + + PR target/45099 + * config/avr/avr.c (avr_function_arg_advance): Error if a fixed + register is needed for a function argument. + 2011-05-16 Richard Guenther <rguenther@suse.de> * gimple.c (struct type_hash_pair): New type. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index ac4b318..c8c363a 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -1796,6 +1796,20 @@ avr_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, cfun->machine->sibcall_fails = 1; } + /* Test if all registers needed by the ABI are actually available. If the + user has fixed a GPR needed to pass an argument, an (implicit) function + call would clobber that fixed register. See PR45099 for an example. */ + + if (cum->regno >= 0) + { + int regno; + + for (regno = cum->regno; regno < cum->regno + bytes; regno++) + if (fixed_regs[regno]) + error ("Register %s is needed to pass a parameter but is fixed", + reg_names[regno]); + } + if (cum->nregs <= 0) { cum->nregs = 0; |