This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/63608] [4.8/4.9 Regression] error: type mismatch in binary expression


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]