23241 – [3.4/4.0/4.1 Regression] Invalid code generated for comparison of uchar to 255 (original) (raw)
Description Joshua Conner 2005-08-05 00:14:42 UTC
The following test code incorrectly generates an assertion failure on gcc mainline and 4.0.1:
#include <assert.h>
struct fbs { unsigned char uc8; } fbs1 = {255};
void testfn ( struct fbs *fbs_ptr ) { if ((fbs_ptr->uc8 != 255) && (fbs_ptr->uc8 != 0)) assert(0); }
int main (int argc, char *argv[]) { testfn (&fbs1); return 0; }
Comment 2 Drea Pinski 2005-08-05 03:35:24 UTC
Confirmed.
Comment 3 Drea Pinski 2005-08-05 03:40:54 UTC
Just a note for fullness, this was caused by the patch which fixed PR 19296.
Comment 4 Eric Botcazou 2005-08-05 04:46:59 UTC
Just a note for fullness, this was caused by the patch which fixed PR 19296.
Right. The annoying thing is that it is in 3.3.6 too so I think someone should fix the typo on the 3.3 branch too.
Comment 5 Joshua Conner 2005-08-05 16:14:23 UTC
Subject: Re: [3.4/4.0/4.1 Regression] Invalid code generated for comparison of uchar to 255
Right. The annoying thing is that it is in 3.3.6 too so I think
someone should fix the typo on the 3.3 branch too.
Will do. Thanks for pointing that out - I would have missed it
otherwise!
- Josh
Comment 12 Drea Pinski 2005-08-08 18:50:29 UTC
Fixed, thanks Josh.
Comment 13 Joseph S. Myers 2006-02-01 00:13:10 UTC
Subject: Bug 23241
Author: jsm28 Date: Wed Feb 1 00:13:07 2006 New Revision: 110456
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110456 Log: Backport: 2005-08-08 Josh Conner <jconner@apple.com>
[PR rtl-optimization/23241](show%5Fbug.cgi?id=23241 "RESOLVED FIXED - [3.4/4.0/4.1 Regression] Invalid code generated for comparison of uchar to 255")
* combine.c (simplify_comparison): Fix error in determining
whether to lift a subreg from comparison.
* gcc.dg/char-compare.c: New test.Added: branches/csl-3_4_3-linux-branch/gcc/testsuite/gcc.dg/char-compare.c - copied unchanged from r110455, branches/gcc-3_4-branch/gcc/testsuite/gcc.dg/char-compare.c Modified: branches/csl-3_4_3-linux-branch/ChangeLog.csl branches/csl-3_4_3-linux-branch/gcc/combine.c