[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] PSTR macro bug in C++

From: Theodore A. Roth
Subject: Re: [avr-gcc-list] PSTR macro bug in C++
Date: Fri, 10 Sep 2004 09:50:22 -0700 (PDT)

On Fri, 10 Sep 2004, Iztok Zupet wrote:

> Hello
>  Just today I discovered a bug. Using the printf_P function and PSTR
> macro causes:
> *App.cpp: In member function `void App::dmxScreen()':
> *App.cpp:47: internal compiler error: in simplify_gen_subreg, at
> simplify-rtx.c:3444
> *Please submit a full bug report,
> I use avr-gcc V 3.4.1 and avr-libc V 1.0.4.
> However, defining PSTR(s) macro as
> #define PSTR(s) ({static char __c[] PROGMEM = (s); &__c[0];})
> instead of
> #define ({static char __c[] PROGMEM = (s); __c;})
> solves this problem.

This is a known problem. See


So, the proposed solutions now are the following:

  #define PSTR(s) ({static char __c[] PROGMEM = (s); &(*__c);})
  #define PSTR(s) ({static char __c[] PROGMEM = (s); &__c[0];})
  #define PSTR(s) ({static char __c[] PROGMEM = (s); (PGM_P)__c;})

The third one seems the most likely to be committed. Any C/C++ gurus
have anything to say on this before I close out the bug (I've been
sitting on this for way too long).

Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]