Jens Staal dixit:

> ./a.out
> sizes: 4 4
> ari_has_31_bit: 0 < 7FFFFFFF = 1
> uari_has_31_bit: 0 < 7FFFFFFF = 1
> uari_has_32_bit: 0 < FFFFFFFF = 1
> uari_wrap_32_bit: FFFFFFFF > 0 = 1

tg@herc:~ $ ./a.out
sizes: 4 4
ari_has_31_bit: 0 < 7FFFFFFF = 1
uari_has_31_bit: 0 < 7FFFFFFF = 1
uari_has_32_bit: 0 < FFFFFFFF = 1
uari_wrap_32_bit: FFFFFFFF > 0 = 1

> Any reason to also try gcc?

No.

I suspect we have a different problem here.
Maybe struct padding.

---------------------------------------------------------------->8
#include <stdio.h>

        struct ctasserts {
        #define cta(name, assertion) char name[1]
/* this one should be defined by the standard */
cta(char_is_1_char, (sizeof(char) == 1) && (sizeof(signed char) == 1) &&
    (sizeof(unsigned char) == 1));
cta(char_is_8_bits, ((CHAR_BIT) == 8) && ((int)(unsigned char)0xFF == 0xFF) &&
    ((int)(unsigned char)0x100 == 0) && ((int)(unsigned char)(int)-1 == 0xFF));
/* the next assertion is probably not really needed */
cta(short_is_2_char, sizeof(short) == 2);
cta(short_size_no_matter_of_signedness, sizeof(short) == sizeof(unsigned 
short));
/* the next assertion is probably not really needed */
cta(int_is_4_char, sizeof(int) == 4);
cta(int_size_no_matter_of_signedness, sizeof(int) == sizeof(unsigned int));

cta(long_ge_int, sizeof(long) >= sizeof(int));
cta(long_size_no_matter_of_signedness, sizeof(long) == sizeof(unsigned long));

#ifndef MKSH_LEGACY_MODE
/* the next assertion is probably not really needed */
cta(ari_is_4_char, sizeof(mksh_ari_t) == 4);
/* but this is */
cta(ari_has_31_bit, 0 < (mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 
1));
/* the next assertion is probably not really needed */
cta(uari_is_4_char, sizeof(mksh_uari_t) == 4);
/* but the next three are; we REQUIRE unsigned integer wraparound */
cta(uari_has_31_bit, 0 < (mksh_uari_t)(((((mksh_uari_t)1 << 15) << 15) - 1) * 2 
+ 1));
cta(uari_has_32_bit, 0 < (mksh_uari_t)(((((mksh_uari_t)1 << 15) << 15) - 1) * 4 
+ 3));
cta(uari_wrap_32_bit,
    (mksh_uari_t)(((((mksh_uari_t)1 << 15) << 15) - 1) * 4 + 3) >
    (mksh_uari_t)(((((mksh_uari_t)1 << 15) << 15) - 1) * 4 + 4));
#endif
/* these are always required */
cta(ari_is_signed, (mksh_ari_t)-1 < (mksh_ari_t)0);
cta(uari_is_unsigned, (mksh_uari_t)-1 > (mksh_uari_t)0);
/* we require these to have the precisely same size and assume 2s complement */
cta(ari_size_no_matter_of_signedness, sizeof(mksh_ari_t) == 
sizeof(mksh_uari_t));

cta(sizet_size_no_matter_of_signedness, sizeof(ssize_t) == sizeof(size_t));
cta(ptrdifft_sizet_same_size, sizeof(ptrdiff_t) == sizeof(size_t));
cta(ptrdifft_voidptr_same_size, sizeof(ptrdiff_t) == sizeof(void *));
cta(ptrdifft_funcptr_same_size, sizeof(ptrdiff_t) == sizeof(void (*)(void)));
/* our formatting routines assume this */
cta(ptr_fits_in_long, sizeof(ptrdiff_t) <= sizeof(long));
        };

int main(void) { printf("%u\n", (unsigned)sizeof(struct ctasserts)); return 
(0); }
---------------------------------------------------------------->8

What’s that say?

> BTW: I checked the man pages of Plan9 diff and it does not have -u. On the

cnuke@ says Plan 9 -c should be equivalent to Unix -u.

> other hand, APE got its own diff so I will test that one or else just copy my
> changed Build.sh to my host Linux and do the diff there.

Sure, works too. (I didn’t understand enough Plan 9 to copy files in or
out, so I ended up doing qemu -hda plan9 -hdb foo.tar and just write an
_uncompressed_ tar to the second hard disc inside… also a workable data
exchange mechanism… but then I also ported using ed as I don’t get acme
*or* sam…)

> I will add -DMKSH__NO_SETEUGID and -DMKSH_NOPROSPECTOFWORK to Plan9 (since 
> both
> ape/cc and gcc - compiled binaries suffer from the same issues regarding those
> two).

Something that adds -DMKSH_NOPROSPECTOFWORK will, however, never be an
official mksh port because it lacks some basic functionality. The
presence of this #ifdef in the sources is intended to be a porting help:
“if mksh works on your OS with it but not without, go fix your kernel^W
POSIX layer”. Adding it in an OS case will never be committed.

Just saying ;-) I’m *very* glad you’re helping the porting efforts,
so please don’t interpret me differently; my language skills aren’t
those of either your average human being or someone English.

bye,
//mirabilos
-- 
<ch> you introduced a merge commit        │<mika> % g rebase -i HEAD^^
<mika> sorry, no idea and rebasing just fscked │<mika> Segmentation
<ch> should have cloned into a clean repo      │  fault (core dumped)
<ch> if I rebase that now, it's really ugh     │<mika:#grml> wuahhhhhh

Reply via email to