The attached patch fixes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27192
Both of these problems occur because the avr backend fails to
recognize function pointer expressions - such as foo + 2
As a result, these references are treated as byte addresses by
assembler, rather word addresses using the pm() directive. The patch
changes the operand check to one that finds the function reference
buried in the expression. (This is similar to code used on the SPARC-gcc)
This patch has been tested using gcc version 4.3.0 20080121
(experimental) with HEAD versions of the AVR files. No regressions
occurred running gcc.c-torture/execute testsuite with simulator and
the PR test cases generate the correct code.
Please comit.
2008-02-16 Andy Hutchinson <hutchinsonandy@aim.com>
PR avr/35013 avr/27192
* avr.h (text_segment_operand): New function to check program
memory address.
* avr.c (text_segment_operand): New function to check program
memory address.
(print_operand_address, avr_assemble_integer): Add new check.