View | Details | Return to bug 42721
Collapse All | Expand All

(-)gcc/fold-const.c (-2 / +6 lines)
Lines 328-340 add_double_with_sign (unsigned HOST_WIDE Link Here
328
  HOST_WIDE_INT h;
328
  HOST_WIDE_INT h;
329
329
330
  l = l1 + l2;
330
  l = l1 + l2;
331
  h = h1 + h2 + (l < l1);
331
  h = (HOST_WIDE_INT)((unsigned HOST_WIDE_INT)h1
332
		      + (unsigned HOST_WIDE_INT)h2
333
		      + (l < l1));
332
334
333
  *lv = l;
335
  *lv = l;
334
  *hv = h;
336
  *hv = h;
335
337
336
  if (unsigned_p)
338
  if (unsigned_p)
337
    return (unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1;
339
    return ((unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1
340
	    || (h == h1
341
		&& l < l1));
338
  else
342
  else
339
    return OVERFLOW_SUM_SIGN (h1, h2, h);
343
    return OVERFLOW_SUM_SIGN (h1, h2, h);
340
}
344
}
(-)gcc/testsuite/gcc.c-torture/execute/pr42721.c.jj (+21 lines)
Line 0 Link Here
1
/* PR c/42721 */
2
3
extern void abort (void);
4
5
static unsigned long long
6
foo (unsigned long long x, unsigned long long y)
7
{
8
  return x / y;
9
}
10
11
static int a, b;
12
13
int
14
main (void)
15
{
16
  unsigned long long c = 1;
17
  b ^= c && (foo (a, -1ULL) != 1L);
18
  if (b != 1)
19
    abort ();
20
  return 0;
21
}

Return to bug 42721