Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,322
    • Issues 4,322
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 362
    • Merge Requests 362
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #1603

Closed
Open
Opened Aug 08, 2007 by Isaac Dupree@trac-Isaac_Dupree

a miscompilation of (`rem` 0x40000000)::Int with -O -fvia-C

eival has the wrong value in this fairly minimal testcase:

module Eival(eival) where
eival :: [Int]
eival = syn [-727299164,-506030719,-906763000,-1356112363,-1183678614,-970206674,-56]

syn :: [Int] -> [Int]
syn (d:ds) = case rem d 0x40000000 of
  synD -> ((:) {-$!-} synD) {-$!-} (syn ds) --strictness/($!)s entirely optional
syn [] = []

expected (and gotten with -O0 or -fasm (or hugs :)): [-727299164,-506030719,-906763000,-282370539,-109936790,-970206674,-56] buggy value: [346442660,567711105,166978824,791371285,963805034,103535150,1073741768]

If the denominator is 0x40000001 or 0x3fffffff, the bug does not occur.

Verified in 6.6.1 and 6.7 on x86-32 Linux.

Only is buggy with both -O and -fvia-C. Adding -optc-O0 or -optc-O3 doesn't change the results.

]gcc --version
gcc (GCC) 4.1.2
Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Linux
Architecture x86
Assignee
Assign to
6.10 branch
Milestone
6.10 branch
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#1603