Thorsten Glaser | 14 Apr 2012 16:24
Picon
Gravatar

[amd64, regression] pcc fails mksh's built-time assertions

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)

Anders Magnusson | 14 Apr 2012 18:00
Picon

Re: [amd64, regression] pcc fails mksh's built-time assertions

It was introduced 6 Jul 2011 20:15:38 when cleaning up some bool stuff.  
I cannot tell why, but at least it is fixed now.

-- Ragge

On 04/14/2012 04:24 PM, Thorsten Glaser wrote:
> 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.
(Continue reading)

Thorsten Glaser | 14 Apr 2012 18:23
Picon
Gravatar

Re: [amd64, regression] pcc fails mksh's built-time assertions

Anders Magnusson dixit:

> It was introduced 6 Jul 2011 20:15:38 when cleaning up some bool stuff.  I
> cannot tell why, but at least it is fixed now.

Thanks! That was fast.

Just to make sure: from the following definitions, one
must be signed and the other unsigned:

typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));

bye,
//mirabilos
--

-- 
If Harry Potter gets a splitting headache in his scar
when he’s near Tom Riddle (aka Voldemort),
does Tom get pain in the arse when Harry is near him?
	-- me, wondering why it’s not Jerry Potter………

Anders Magnusson | 20 Sep 2012 21:42
Picon

Re: [amd64, regression] pcc fails mksh's built-time assertions

On 04/14/2012 06:23 PM, Thorsten Glaser wrote:
> Anders Magnusson dixit:
>
>> It was introduced 6 Jul 2011 20:15:38 when cleaning up some bool stuff.  I
>> cannot tell why, but at least it is fixed now.
> Thanks! That was fast.
>
> Just to make sure: from the following definitions, one
> must be signed and the other unsigned:
>
> typedef int int32_t __attribute__ ((__mode__ (__SI__)));
> typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
That is what it is supposed to be :-)

-- Ragge


Gmane