Bug 23096 - Wrong folding for FLOOR_MOD_EXPR
Wrong folding for FLOOR_MOD_EXPR
Status: NEW
Product: gcc
Classification: Unclassified
Component: middle-end
4.1.0
: P2 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks: 22348
  Show dependency treegraph
 
Reported: 2005-07-27 16:36 UTC by Andrew Pinski
Modified: 2006-02-13 03:55 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-13 03:55:08


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-07-27 16:36:08 UTC
See PR 22348 for the full analysis of this bug.
Comment 1 Andrew Pinski 2005-07-27 16:38:53 UTC
From comment #7 of PR 22348:
extract_muldiv(51 - 7, 3, FLOOR_MOD_EXPR) returns incorrectly 0.

The reason is that 51 - 7 is replaced with 51 + ~6, and both 51 and ~6 are
divisible by 3, so the result obviously is 0 :-) Someone forgot about overflows.