EmbDev.net

Forum: ARM programming with GCC/GNU tools GCC bug? yagarto


Author: A. S. (aleksazr)
Posted on:
Attached files:

Rate this post
0 useful
not useful
The prog I've attached reads a dword from SAM9260's DBGU
port and echoes it back.

First it calls RecvDword, which calls RecvByte 4 times,
then SendDword, which calls SendByte 4 times.

The SEND side works, READ side has problems.

Start the make.bat then inspect src.lss and you will see
that RecvByte is called only once.

Now, either add 'volatile' to line 15 of src.c
 or change -Os to -O3 in make.bat
and RecvByte will be called 4 times.

I've tested this with real hardware,
not just by looking into src.lss.
If I send (with another comp) 0x12345678,
I get back 0x78787878, i.e. only the first byte sent.

I'm still a bit new to c language,
but this is a GCC bug, right?

I'm using yagarto (GCC 4.5.0)

Author: A. K. (prx)
Posted on:

Rate this post
0 useful
not useful
Please add the LSS file. Do not expect others to have the exactly same 
compiler version.

Author: A. S. (aleksazr)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Ok, here are the 3 LSS files.

Author: A. K. (prx)
Posted on:

Rate this post
0 useful
not useful
Indeed it looks like a compiler bug. gcc 4.3.2 and 4.4.1 from 
codesourcery are fine though.

Author: A. S. (aleksazr)
Posted on:

Rate this post
0 useful
not useful
Besides 4.5.0, I also have yagarto with GCC 4.4.2. and it works fine,
but using -Os has no effect (at least not with this example).

If someone has the energy to fight with the bugzilla
report, please do so.

Author: A. K. (prx)
Posted on:

Rate this post
0 useful
not useful
Bugzilla #45052

Author: A. K. (prx)
Posted on:

Rate this post
0 useful
not useful
Workaround: add -fno-ipa-pure-const

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.