This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 12 Jun 2015 09:06:33 +0000
- Subject: [Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression
- Auto-submitted: auto-generated
- References: <bug-63608-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63608
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Less artificially looking testcase.
/* PR middle-end/63608 */
typedef long T;
typedef unsigned long U;
unsigned long a;
unsigned long
foo (int b)
{
T c = 0;
const U d = 2248593032UL;
a = (c = +d) | (~4L & ~b);
return c;
}
Testing the backport now, seems fold-const.c pretty much assumes everywhere
that if argN is INTEGER_CST, then argN == opN, but the missing NON_LVALUE_EXPR
case of course breaks this. So, fixing it at the spots that just pass argN if
it is known to be INTEGER_CST is not really doable.
If the patch would be too dangerous (most likely is not), then another option
is just to fold NON_LVALUE_EXPR of INTEGER_CST to the INTEGER_CST.