This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch,AVR]: Fix PR56263
- From: Denis Chertykov <chertykov at gmail dot com>
- To: Georg-Johann Lay <avr at gjlay dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Eric Weddington <eric dot weddington at atmel dot com>
- Date: Tue, 12 Mar 2013 11:13:56 +0400
- Subject: Re: [Patch,AVR]: Fix PR56263
- References: <513E1C62.70404@gjlay.de>
2013/3/11 Georg-Johann Lay <avr@gjlay.de>:
> This patch implements a new warning option -Waddr-space-convert warns about
> conversions to a non-containing address space.
>
> Address spaces are implemented in such a way that each address space is
> contained in each other space so that casting is possible, e.g. in code like
>
> char read_c (bool in_flash, const char *str)
> {
> if (in_flash)
> return * (const __flash char*) str;
> else
> return *str;
> }
>
> However, there are no warning about implicit or explicit address space
> conversions, which makes it hard to port progmem code to address space code.
>
> If an address space qualifier is missing, e.g. when calling a function that is
> not qualified correctly, this would result in wrong code (in contrast to
> pgm_read that work no matter how the address is qualified).
>
> There is still some work to do to get more precise warnings and this is just a
> first take to implement PR56263, see the FIXME in the source.
>
> The details can be worked out later, e.g. for 4.8.1.
>
>
> Ok for trunk?
>
>
> PR target/56263
> * config/avr/avr.c (TARGET_CONVERT_TO_TYPE): Define to...
> (avr_convert_to_type): ...this new static function.
> * config/avr/avr.opt (-Waddr-space-convert): New C option.
> * doc/invoke.texi (AVR Options): Document it.
Approved.
Denis.