From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18199 invoked by alias); 20 Oct 2004 22:27:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 18186 invoked by alias); 20 Oct 2004 22:27:29 -0000 Date: Wed, 20 Oct 2004 22:27:00 -0000 Message-ID: <20041020222729.18185.qmail@sourceware.org> From: "schlie at comcast dot net" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20041019202143.18065.schlie@comcast.net> References: <20041019202143.18065.schlie@comcast.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/18065] usual arithmetic conversion not applying correctly X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg02710.txt.bz2 List-Id: ------- Additional Comments From schlie at comcast dot net 2004-10-20 22:27 ------- Subject: Re: usual arithmetic conversion not applying correctly Andrew, It has nothing to do with "optimizing code", if the 3.X and 4.X front-ends are promoting the size of anything other than bool, enum, or bit-field operand values without explicit need, they're doing so in error, and in contradiction to the standard's semantics. (could you please check on this, as it should be clear that it's wrong, although may have gone unnoticed as most of GCC's targets are 32+ bit machines, and would have escaped detection, as on most larger machines most operations are converted by default to int as that's all they know about, it's only when the result is stored, does the operations required size express itself. It's a pretty major screw-up to presume all target machines are large, and then to encode that presumption into C's front end; not to mention it seems pretty stupid to do, and then worry about trying to optimize operand values into smaller sizes when subsequently realizing that their size promotion was not required, and calling it an optimization; the whole mess is more accurately a de-optimization, and perversion of C's semantics.) Thanks, -paul- > From: jsm at polyomino dot org dot uk > Reply-To: > Date: 20 Oct 2004 21:31:15 -0000 > To: > Subject: [Bug c/18065] usual arithmetic conversion not applying correctly > > > ------- Additional Comments From jsm at polyomino dot org dot uk 2004-10-20 > 21:31 ------- > Subject: Re: usual arithmetic conversion not applying correctly > > On Wed, 20 Oct 2004, pinskia at gcc dot gnu dot org wrote: > >> Otherwise, the integer promotions are performed on both operands. Then >> the following rules are applied to the promoted operands: If both >> operands have the same type, then no further conversion is needed. > > The integer promotions are where signed char is promoted to int. Only > after then are types compared. > > It is not the job of the front end to optimise code. The front end should > generate datastructures corresponding exactly to the specified semantics > of the language, including the promotions in this case. Subsequent > passes, preferably on GIMPLE but maybe including fold at present, can deal > with eliminating conversions not needed for code generation. > > -- > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18065 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18065