[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-chat] Strange struct problem
From: |
Daniel O'Connor |
Subject: |
[avr-chat] Strange struct problem |
Date: |
Fri, 9 Dec 2005 10:37:05 +1030 |
User-agent: |
KMail/1.8.2 |
Hi,
I am getting this odd problem with structs. If the size of the struct
is larger than 4 bytes I can't access it.. It's most peculiar.
I have a test case (attached).
Build it with..
avr-gcc -O2 -fno-strict-aliasing -pipe -g -Wall -Wunreachable-code
-DF_CPU=16000000 -mmcu=atmega32 -Wa,-adhlmsn=testcase.lst -c testcase.c -o
testcase.o
avr-gcc -O2 -fno-strict-aliasing -pipe -g -Wall -Wunreachable-code
-DF_CPU=16000000 -mmcu=atmega32 -Wl,-Map=testcase.map,--cref -g testcase.o -o
testcase.elf
avr-objcopy -j .text -O ihex testcase.elf testcase.hex
avr-objdump -S testcase.elf > testcase.dmp
If BREAKME is defined all the struct accesses return 255 instead of what
they should be (I think :)
I am wondering if there is some oddity with GCC optimising for <= 4 byte
structs which unbreaks my code, but I can't see why it is broken.
Any help gratefully received!
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
testcase.c
Description: Text Data
pgpukISoW20dD.pgp
Description: PGP signature
- [avr-chat] Strange struct problem,
Daniel O'Connor <=
- Re: [avr-chat] Strange struct problem, Daniel O'Connor, 2005/12/08
- Re: [avr-chat] Strange struct problem, Russell Shaw, 2005/12/08
- Re: [avr-chat] Strange struct problem, Daniel O'Connor, 2005/12/08
- RE: [avr-chat] Strange struct problem, Larry Barello, 2005/12/08
- RE: [avr-chat] Strange struct problem, Larry Barello, 2005/12/08
- Re: [avr-chat] Strange struct problem, Russell Shaw, 2005/12/08
- Re: [avr-chat] Strange struct problem, Daniel O'Connor, 2005/12/08
- RE: [avr-chat] Strange struct problem, Larry Barello, 2005/12/08