On 2006-09-13, Peter Jansen <peter.jan...@aad.gov.au> wrote:

> I have compiled the example and I need more code to check that it is not 
> working. Its something to do with the optimizer (which is taking out the 
> call to memset).

Take a look at the memcpy() example I just posted.  You don't
need anything except to the generated source file to determine
that it's wrong.

> Here is the generated function,
>
>> /***********************
>>  * Function `bar'
>>  ***********************/
>> bar:
>> /* prologue: frame size = 0 */
>> .L__FrameSize_bar=0x0
>> .L__FrameOffset_bar=0x0
>> /* prologue end (size=0) */
>>         mov     #llo(21845), &foo+1
>>         ret
>> /* epilogue: not required */
>> /* function bar size 4 (3) */
>> .Lfe1:
>>         .size   bar,.Lfe1-bar
>> /********* End of function ******/
>> 
>>         .comm foo,4,2
>
> The thing is that the ".comm foo,4,2" line specifies that foo must be 
> word aligned, this goes to the linker which is required to align the 
> variable foo at link time.

And it is.

> This should be done, Ill check.

foo is aligned just fine on a word boundary.

> For me the generated code looks fine.

What?  You just admitted foo is aligned on a word boundary.
Therefore foo+1 _isn't_ on a word boundary.  The compiler
generated a word move with &foo+1 as the destination.  How is
that fine?

-- 
Grant Edwards                   grante             Yow!  Is something VIOLENT
                                  at               going to happen to a
                               visi.com            GARBAGE CAN?


Reply via email to