dpc <[email protected]> writes:
> Joerg Wunsch <[email protected]> writes:
>
>> As Weddington, Eric wrote:
>>
>>> I would actually suggest using GCC 4.4.3. It's gotten more testing
>>> than the bleeding edge.
>>
>> Nevertheless, wouldn't an ICE be worth a (GCC) bug report anyway?
>
> this is gcc 44643
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44643
jsm28 commented in the bug:
> This is a bug in the AVR back end; if it marks a decl readonly it must
> also adjust the type of the decl. The problem code is probably in
> avr_insert_attributes.
i think the code jsm28 is referring to in avr_insert_attributes is:
/* ??? This seems sketchy. Why can't the user declare the
thing const in the first place? */
TREE_READONLY (node) = 1;
i did a little futzing w/ the type of the decl via TREE_TYPE(node) and
was able to avoid the ice but the comment got me thinking this was
probably not the best thing (plus i had actual work to get back to :-).
anyway, if i go back to libc/stdlib/dtostre.c and change the
str_[nan|inf] decls to be 'const char' (and update s's decl) there's no
more ICE (although, as eric noted gcc trunk is not the recommended
environment and a nicer error message from gcc would be nice).
would a patch like this be ok?
--- avr-libc-1.6.8/libc/stdlib/dtostre.c 2010-06-23 09:09:19.000000000 -0700
+++ avr-libc/libc/stdlib/dtostre.c 2010-06-23 09:15:06.000000000 -0700
@@ -26,7 +26,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. */
-/* $Id: dtostre.c,v 1.2.2.1 2009/04/01 23:12:10 arcanum Exp $ */
+/* $Id: dtostre.c 1944 2009-04-01 23:12:20Z arcanum $ */
#include <stdlib.h>
#include <avr/pgmspace.h>
@@ -37,19 +37,19 @@
char *
dtostre (double val, char *sbeg, unsigned char prec, unsigned char flags)
{
- __attribute__((progmem)) static const char str_nan[2][4] =
+ __attribute__((progmem)) static char str_nan[2][4] =
{"nan", "NAN"};
- __attribute__((progmem)) static const char str_inf[2][sizeof(str_nan[0])] =
+ __attribute__((progmem)) static char str_inf[2][sizeof(str_nan[0])] =
{"inf", "INF"};
char *d; /* dst */
- const char *s; /* src */
+ char *s; /* src */
signed char exp;
unsigned char vtype;
if (prec > 7) prec = 7;
exp = __ftoa_engine (val, sbeg, prec, 0);
- d = (char*)(s = sbeg);
+ d = s = sbeg;
vtype = *s++;
if ((vtype & FTOA_MINUS) && !(vtype & FTOA_NAN)) /* like 'Glibc' */
\p
---
It is always the best policy to tell the truth, unless, of course, you
are an exceptionally good liar. - Jerome K. Jerome
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev