Ticket #952 (closed merge: fixed)
gcc should be passed the -fwrapv flag
| Reported by: | simonmar | Owned by: | igloo |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.6.1 |
| Component: | Compiler | Version: | 6.6 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
I get a floating point exception building HEAD with 6.6. I tracked it down to getCommonNodeUFMData in UniqFM:
getCommonNodeUFMData :: NodeUFMData -> NodeUFMData -> NodeUFMData
getCommonNodeUFMData (NodeUFMData i p) (NodeUFMData i2 p2)
| p ==# p2 = getCommonNodeUFMData_ p j j2
| p <# p2 = getCommonNodeUFMData_ p2 (j `quotFastInt` (p2 `quotFastInt` p)) j2
| otherwise = getCommonNodeUFMData_ p j (j2 `quotFastInt` (p `quotFastInt` p2))
where
l = (_ILIT(1) :: FastInt)
j = i `quotFastInt` (p `shiftL_` l)
j2 = i2 `quotFastInt` (p2 `shiftL_` l)
getCommonNodeUFMData_ :: FastInt -> FastInt -> FastInt -> NodeUFMData
getCommonNodeUFMData_ p j j_
| j ==# j_
= NodeUFMData (((j `shiftL_` l) +# l) *# p) p
| otherwise
= getCommonNodeUFMData_ (p `shiftL_` l) (j `shiftR_` l) (j_ `shiftR_` l)
The division j2 is a divide-by-zero; p2 is zero.
Compiling UniqFM with DEBUG makes it go away. Compiling with -fasm has no effect, so it isn't dependent on the back-end.
This may be architecture-specific; I've only seen it on x86_64 so far.
Change History
Note: See
TracTickets for help on using
tickets.
