AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
westfw
PostPosted: Dec 01, 2008 - 07:32 AM
Wannabe


Joined: Jun 19, 2002
Posts: 91
Location: SF Bay area

Is there a known bug in g++ 4.3.0 with respect to atributes that are a part of a typedef or something? I have this trivial program pgmspace.c:
Code:
BillW-MacOSX<1059> cat pgmspace.c
#include <avr/pgmspace.h>

prog_uchar foo [10][10] = { 0 };
BillW-MacOSX<1060>


When compiled with gcc, it does what I expect:
Code:

BillW-MacOSX<1060> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-gcc pgmspace.c -mmcu=atmega168 -c -o pgmspace43cc.o --version
avr-gcc (GCC) 4.3.0
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BillW-MacOSX<1061> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-gcc pgmspace.c -mmcu=atmega168 -c -o pgmspace43cc.o
BillW-MacOSX<1062> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-size pgmspace43cc.o
   text    data     bss     dec     hex filename
    100       0       0     100      64 pgmspace43cc.o
BillW-MacOSX<1063>

But when compiled with g++, the data is NOT put in program memory:
Code:
BillW-MacOSX<1063> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-g++ pgmspace.c -mmcu=atmega168 -c -o pgmspace43c++.o --version
avr-g++ (GCC) 4.3.0
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BillW-MacOSX<1064> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-g++ pgmspace.c -mmcu=atmega168 -c -o pgmspace43c++.o         
BillW-MacOSX<1065> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-size pgmspace43c++.o
   text    data     bss     dec     hex filename
      0       0     100     100      64 pgmspace43c++.o


(Yes, this is the pre-built macos binary distributed with the Arduino environment. Can someone try it with a more normal distribution?)

I can't tell whether this is related or not:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
 
 View user's profile Send private message  
Reply with quote Back to top
dl8dtl
PostPosted: Dec 01, 2008 - 07:56 AM
Raving lunatic


Joined: Dec 20, 2002
Posts: 6697
Location: Dresden, Germany

I can confirm this:

Code:

j@uriah 197% avr-gcc-4.3.1 -mmcu=atmega168 -c foo.C; avr-size foo.o
   text    data     bss     dec     hex filename
      0       0     100     100      64 foo.o
j@uriah 198% avr-gcc-4.2.2 -mmcu=atmega168 -c foo.C ; avr-size foo.o
   text    data     bss     dec     hex filename
    100       0       0     100      64 foo.o


No, bug 34734 appears to be unrelated. First, it already applies to
GCC 4.2.x, and then, it's a warning only but the generated code is
fine there.

I'd say file a GCC bug report for it.

_________________
Jörg Wunsch

Please don't send me PMs, use email instead.
Please read the `General information...' article before.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
westfw
PostPosted: Dec 01, 2008 - 09:15 AM
Wannabe


Joined: Jun 19, 2002
Posts: 91
Location: SF Bay area

Created http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38342
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits