M
Mattias Ekholm
Hi
The error is indeed a compiler fault! Don't bother what every one else
says. I encountered the same problem with an Alpha processor.
The problem is that the shift assembler instruction with immediate
oparand are only able to contain left shift values up to 23 (all bit
sets in operand field), try investigate the assebler manual for details.
The compiler failes to identify the need for storing the operand in a
register instead.
kind regards
Mattias Ekholm
The error is indeed a compiler fault! Don't bother what every one else
says. I encountered the same problem with an Alpha processor.
The problem is that the shift assembler instruction with immediate
oparand are only able to contain left shift values up to 23 (all bit
sets in operand field), try investigate the assebler manual for details.
The compiler failes to identify the need for storing the operand in a
register instead.
kind regards
Mattias Ekholm
CBFalconer wrote:
unsigned int* sram_location = (unsigned int *) 0xFF120011;
Undefined behavior here.
Mmmmm, nope.
[#5] An integer may be converted to any pointer type. |
Except as previously specified, the result is
implementation-defined, might not be properly aligned, and
might not point to an entity of the referenced type.49)
49)The mapping functions for converting a pointer to an
integer or an integer to a pointer are intended to be
consistent with the addressing structure of the execution
environment.
Assignment is ok. Use of it is problematic.
Brian Rodenborn
Sorry to post defective code....I was to quick in cutting the problem out of
entire code... I think it is my compiler tricking me :-(, the "unsigned int*
sram_location = (unsigned int *) 0xFF120011" is okay because the code is
intended for a microcontroller that has a peripheral device memory-mapped at
this location.
I solved the problem though, but do still not understand it...I think the
error lies in the compiler and dont think the error is easily seen. When I
did:
*sram_location = ( ((measuredata.n1.number1)<<24) | (
(measuredata.n1.number2)<<16) | ( (measuredata.n2.number3)>>16) );
I got the 0x1A000000
When I do the:
*sram_location = (
((measuredata.n1.number1<<16)<<8) | ((measuredata.n1.number2)<<16) | (
(measuredata.n2.number3) >>16) );
I get the correct result: 0x34000000
Dont ask me why......
Thank you all for your time, effort and patience.
Best Regards
Jannick