jed-users mailing list

[2008 Date Index] [2008 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Patches


Hi John,

"John E. Davis" <davis@xxxxxxxxxxxxx> wrote:
> Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
>>     % cat cast-test.c
>>     int main(void)
>>    {
>>         char buf[10] = { 0 };
>>         int *a = (int*)&buf[1];
>>         *a = 0x7a7a7a;
>>
>>         return 0;
>>    }
>>     % gcc -Wall -Wcast-align cast-test.c -o cast-test
>>     cast-test.c: In function `main':
>>     cast-test.c:4: warning: cast increases required alignment of target type
>>     % ./cast-test
>>     Unaligned access pid=398552 <cast-test> va=0x11fffbfe1 pc=0x12000112c ra=0x1200010ac inst=0xb0220000
>
> Do you have an example of where this actually happens in jed?

No, I only saw the compiler warning in the build log. I tried the example
above on True64 and the operating system corrects the unaligned access.
But some years ago I've work with an ARM processor without an operating
system where such unaligned accesses returned junk.

> I regard it as a bug and would like to fix it.  I realize that a cast
> such as (double*)(char*) might generate a compiler warning, but it is
> only an error when the pointer being cast is actually unaligned.

I don't know if this can happen in the real world. Until now, we didn't
get a bug report for this. But I don't know if we have user of the
effected architectures; alpha, arm, hppa, ia64, mipsel, mips, sparc.

Bye, Jörg.
-- 
NetBSD ist für Frauen: es läuft auf Waschmaschinen

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2008 date index] [2008 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]