14 Apr 2012 16:24
[amd64, regression] pcc fails mksh's built-time assertions
Thorsten Glaser <tg <at> mirbsd.de>
2012-04-14 14:24:58 GMT
2012-04-14 14:24:58 GMT
Hi,
this used to work:
(pbuild21152)root <at> builds:~/mksh # cat x.c
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int32_t mksh_ari_t;
struct ctasserts {
char ari_is_signed[((mksh_ari_t)-1 < (mksh_ari_t)0) ? 1 : -1];
char ari_sign_32_bit_and_wrap[((mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 1) >
(mksh_ari_t)(((((mksh_ari_t)1 << 15) << 15) - 1) * 2 + 2)) ? 1 : -1];
};
int main(void) { return (sizeof(struct ctasserts)); }
(pbuild21152)root <at> builds:~/mksh # gcc x.c; echo = $?
x.c:5: warning: integer overflow in expression
= 0
(pbuild21152)root <at> builds:~/mksh # pcc x.c; echo = $?
x.c, line 4: array size cannot be negative
x.c, line 5: array size cannot be negative
= 1
The int32_t definition is straight from eglibc (this is a
Debian squeeze/amd64 chroot), the rest is mksh’s assertion
check code.
Why is mksh_ari_t suddenly unsigned, or appears so?
bye,
//mirabilos
(Continue reading)
-- Ragge
RSS Feed