From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Haertel Message-Id: <200107161921.f6GJL7c10659@ducky.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] another compiler bug (another try to send this coherently) In-Reply-To: <020901c10e28$6fbafa50$3cf7c6d4@SOMA> Date: Mon, 16 Jul 2001 12:21:07 -0700 Topicbox-Message-UUID: cf2bc59a-eac9-11e9-9e20-41e7f4b1d025 >> Whatever it prints, it should print the same number twice, >> not two different values. > >obviously the unsigned char is _not_ being promoted to signed int. > >just _what_ are you trying to do? The unsigned char is _supposed_ to be promoted to signed int. I'm not actually trying to do anything that depends on this. I have been writing some high-performance AES (Rijndael) encryption routines lately. I decided the portability problems associated with relying on compilers getting the ANSI C rules exactly right were too much of a headache, so I went through the code to put in explicit casts anywhere implicit conversions would otherwise occur, to prevent broken compilers (like 8c) from doing the Wrong Thing. I was reviewing my code, with the help of "8c -t" to print the parse trees and make sure there were no implicit promotions left, when I stumbled across a few more I had overlooked, and noticed moreover that 8c was inserting "CAST UINT" in places where ANSI says it should have inserted "CAST INT". So I reported it as a bug. It wasn't causing me any trouble, but I think these things should be fixed whenever you find them. Somewhere down the road it'll save some poor sot from hours of head scratching when attempting import something with pcc.