SV: [Icc-avr] Compiler bug?

Bengt Ragnemalm benra at imt.liu.se
Sun May 6 23:45:16 PDT 2007


Please Richartd, try to be patient with me. I am just trying to get some
help and am truly sorry if you are feeling “spammed”. I will try to be more
precise in the future.

 

My problem is that I do not get any result from the simple division
“ppgAcDiff = ppgAcDiff/acGain;”

 

As I said, I always am very careful about accusing the compiler as it is not
normally the cause and especially not for simple things like this. But in
this case I am running it in Studio and after just adding the :
ppgAcDiff++; (and also a ppgACDiff--;) The result is not the same, not even
the result from the function there the result from the division is used.

 

As John said, the move should be unnecessary but in my testing, the result
from the function did change. I will try to use a test function that do
something simple and see the result. I get back. Maybe the problem is in the
function. 

 

And Richard again, I am used to ask all kind of questions here, one more
stupid than the other, and I am used to get great support from you or anyone
else here so I am not so used that you being so angry with me. Could it
possible be that you have little black devil on your shoulder that triggers
on the “compiler bug” condition? It that is so, please use a frying pan or
something and smash it down, I do not want to upset anyone (maybe I did so
right now which I didn’t intended either)

 

Sincerely

Bengt Ragnemalm 

 

  _____  

Från: icc-avr-bounces at imagecraft.com [mailto:icc-avr-bounces at imagecraft.com]
För John Baraclough
Skickat: den 4 maj 2007 18:27
Till: benra at imt.liu.se; Discussion list for ICCAVR and ICCtiny Users. You do
NOT need tosubscribe to icc-announce if you are a member of this.
Ämne: Re: [Icc-avr] Compiler bug?

 

Hi Bengt,

I assume the function at 0x00000A68 in your first listing is 'div16s', in
which case the result is returned in R16/R17. That being so, then the first
parameter being passed to the function 

S_ShortFilter(ppgAcDiff, &filtMem[channel], filterdjup,
&firFiltMem[channel]);

is already in the correct register pair and doesn't need to be moved. Sorry,
but I don't think he problem is with the compiler.

All the best for now,
John


At 13:44 04/05/2007, you wrote:



Hi.
 
I know that I am usually wrong about this but this looks like a compiler bug
to me. Please have look.
 
ppgAcDiff and acGain are signed short.
 
This simple line didn’t do anything so I checked the assembler. Actually
this is very similar to my previous problem but this time the variable is
used at the line right after. Just to provoke, I inserted a simple ++ in
between and yes, now the result is saved. What is going on here?
 
ppgAcDiff = ppgAcDiff/acGain;
 
 
411:                ppgAcDiff = ppgAcDiff/acGain;
+0000020D:   019C        MOVW    R18,R24          Copy register pair
+0000020E:   0187        MOVW    R16,R14          Copy register pair
+0000020F:   940E0A68    CALL    0x00000A68       Call subroutine
414:                subtractTotalDiffFiltered = S_ShortFilter(ppgAcDiff,
&filtMem[channel], filterdjup, &firFiltMem[channel]);
 
 
 
411:                ppgAcDiff = ppgAcDiff/acGain;
+0000020D:   019C        MOVW    R18,R24          Copy register pair
+0000020E:   0187        MOVW    R16,R14          Copy register pair
+0000020F:   940E0A6D    CALL    0x00000A6D       Call subroutine
+00000211:   0178        MOVW    R14,R16          Copy register pair
412:      ppgAcDiff++;
+00000212:   01C7        MOVW    R24,R14          Copy register pair
+00000213:   9601        ADIW    R24,0x01         Add immediate to word
+00000214:   017C        MOVW    R14,R24          Copy register pair
414:                subtractTotalDiffFiltered = S_ShortFilter(ppgAcDiff,
&filtMem[channel], filterdjup, &firFiltMem[channel]);
 
/Bengt
________________________________________________________________

Bengt Ragnemalm                         Tel +46 13 22 24 97

Research engineer                                       FAX: +46 13 10 19 02

Linköpings Universitet
mailto:bengt.ragnemalm at imt.liu.se

Inst. för Medicinsk Teknik Internet:         <http://www.imt.liu.se/>
http://www.imt.liu.se

S-581 85 Linköping SWEDEN

 
 
_______________________________________________
Icc-avr mailing list
Icc-avr at imagecraft.com
http://dragonsgate.net/mailman/listinfo/icc-avr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20070507/8eeca777/attachment.html


More information about the Icc-avr mailing list