[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Any way to emulate hppa? Was: gforth FTBFS on hppa



On Tue, Sep 8, 2009 at 11:54 AM, John David
Anglin<dave@hiauly1.hia.nrc.ca> wrote:
>> > =A0 typedef char * ac__type_sizeof_;
>> > int
>> > main ()
>> > {
>> > static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_)))=
>>  <=3D $ac_mid)];
>> > test_array [0] =3D 0
>> >
>> > =A0;
>> > =A0return 0;
>> > _ACEOF
>> >
>> > ...which is built with different values for $ac_mid.
>> >
>> > The difference between gforth-0.7.0 (where this fails) and 0.6.2
>> > (where it was built successfully on hppa) seems to be that 0.7.0
>> > uses a typedef to do the sizeof, whereas 0.6.2 did a straight
>> > sizeof (char *) in the test_array definition. =A0If this should make
>> > GCC fail on this code, I'd be quite surprised, but... it seems to
>> > be just so... :>
>>
>> Dave, what do you think of this code?
>
> The C standard doesn't allow using an array to access memory outside
> the bounds of the array (that's not exactly right, but close enough).
> On hppa, doing this will result in a segv if -mdisable-indexing isn't
> specified.
>
> Much of Ada is built using this option.  I haven't played with Forth in
> years, but I suspect it may also need to use -mdisable-indexing for
> certain code.

Thanks Dave.

Peter, can you try adding -mdisable-indexing to the CFLAGS used for
this check when building for hppa?

Cheers,
Carlos.


Reply to: