#1989: GHC-6.8.1 fails arith003 on amd64/FreeBSD-7.0
----------------------+-----------------------------------------------------
Reporter: wb.kloke | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.2
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: x86_64 (amd64)
Os: FreeBSD |
----------------------+-----------------------------------------------------
Old description:
> I am trying to build a native amd64 compiler on FreeBSD. At the bootstrap
> stage I use the -i386
> compiler as ghc: This works to stage1. The stage1 compiler is usable in a
> limited way. But the stage2 compiler built with this fails very early
> (before even complaining about missing -B options, if started naked).
>
> Ex.:
> /home/wb.local/ghc-6.8.2 0$ compiler/stage2/ghc-6.8.2
> Segmentation fault: 11 (core dumped)
> [EMAIL PROTECTED]:ttyp2
> /home/wb.local/ghc-6.8.2 0$ compiler/stage1/ghc-6.8.2
> ghc-6.8.2: missing -B<dir> option
>
> The most reproducable misbehaviour of the stage1 compiler is the
> unability to run test arith003. The value minInt is converted to a
> nonprintable 1-char string in the int_ops part. Most other results,
> including the multiple precision tests, look better than the output from
> x86-64-openbsd (as published with the 6.6.1-testsuite). It looks as if
> there is a specific problem with bit pattern 0x8000000000000000L. If I
> change the source code to avoid this pattern (minInt -> minInt+1) the
> error does not occur.
>
> First lines of arith003 output:
>
> (+) 0 0 = 0
> (+) 0 1 = 1
> (+) 0 -1 = -1
> (+) 0 2 = 2
> (+) 0 -2 = -2
> (+) 0 -<FC>8 = -<FC>8
> (+) 0 9223372036854775807 = 9223372036854775807
> (+) 1 0 = 1
> (+) 1 1 = 2
> (+) 1 -1 = 0
> (+) 1 2 = 3
> (+) 1 -2 = -1
> (+) 1 -<FC>8 = -9223372036854775807
> (+) 1 9223372036854775807 = -<FC>8
> (+) -1 0 = -1
> (+) -1 1 = 0
> (+) -1 -1 = -2
> (+) -1 2 = 1
> (+) -1 -2 = -3
> (+) -1 -<FC>8 = 9223372036854775807
> (+) -1 9223372036854775807 = 9223372036854775806
> (+) 2 0 = 2
> (+) 2 1 = 3
> (+) 2 -1 = 1
> (+) 2 2 = 4
> (+) 2 -2 = 0
> (+) 2 -<FC>8 = -9223372036854775806
> (+) 2 9223372036854775807 = -9223372036854775807
> (+) -2 0 = -2
> (+) -2 1 = -1
> (+) -2 -1 = -3
> (+) -2 2 = 0
> (+) -2 -2 = -4
> (+) -2 -<FC>8 = 9223372036854775806
> (+) -2 9223372036854775807 = 9223372036854775805
> (+) -<FC>8 0 = -<FC>8
> (+) -<FC>8 1 = -9223372036854775807
> (+) -<FC>8 -1 = 9223372036854775807
> (+) -<FC>8 2 = -9223372036854775806
> (+) -<FC>8 -2 = 9223372036854775806
> (+) -<FC>8 -<FC>8 = 0
> (+) -<FC>8 9223372036854775807 = -1
> (+) 9223372036854775807 0 = 9223372036854775807
> (+) 9223372036854775807 1 = -<FC>8
> (+) 9223372036854775807 -1 = 9223372036854775806
> (+) 9223372036854775807 2 = -9223372036854775807
> (+) 9223372036854775807 -2 = 9223372036854775805
> (+) 9223372036854775807 -<FC>8 = -1
> (+) 9223372036854775807 9223372036854775807 = -2
> ...
New description:
I am trying to build a native amd64 compiler on FreeBSD. At the bootstrap
stage I use the -i386
compiler as ghc: This works to stage1. The stage1 compiler is usable in a
limited way. But the stage2 compiler built with this fails very early
(before even complaining about missing -B options, if started naked).
{{{
Ex.:
/home/wb.local/ghc-6.8.2 0$ compiler/stage2/ghc-6.8.2
Segmentation fault: 11 (core dumped)
[EMAIL PROTECTED]:ttyp2
/home/wb.local/ghc-6.8.2 0$ compiler/stage1/ghc-6.8.2
ghc-6.8.2: missing -B<dir> option
}}}
The most reproducable misbehaviour of the stage1 compiler is the unability
to run test arith003. The value minInt is converted to a nonprintable
1-char string in the int_ops part. Most other results, including the
multiple precision tests, look better than the output from x86-64-openbsd
(as published with the 6.6.1-testsuite). It looks as if there is a
specific problem with bit pattern 0x8000000000000000L. If I change the
source code to avoid this pattern (minInt -> minInt+1) the error does not
occur.
First lines of arith003 output:
{{{
(+) 0 0 = 0
(+) 0 1 = 1
(+) 0 -1 = -1
(+) 0 2 = 2
(+) 0 -2 = -2
(+) 0 -<FC>8 = -<FC>8
(+) 0 9223372036854775807 = 9223372036854775807
(+) 1 0 = 1
(+) 1 1 = 2
(+) 1 -1 = 0
(+) 1 2 = 3
(+) 1 -2 = -1
(+) 1 -<FC>8 = -9223372036854775807
(+) 1 9223372036854775807 = -<FC>8
(+) -1 0 = -1
(+) -1 1 = 0
(+) -1 -1 = -2
(+) -1 2 = 1
(+) -1 -2 = -3
(+) -1 -<FC>8 = 9223372036854775807
(+) -1 9223372036854775807 = 9223372036854775806
(+) 2 0 = 2
(+) 2 1 = 3
(+) 2 -1 = 1
(+) 2 2 = 4
(+) 2 -2 = 0
(+) 2 -<FC>8 = -9223372036854775806
(+) 2 9223372036854775807 = -9223372036854775807
(+) -2 0 = -2
(+) -2 1 = -1
(+) -2 -1 = -3
(+) -2 2 = 0
(+) -2 -2 = -4
(+) -2 -<FC>8 = 9223372036854775806
(+) -2 9223372036854775807 = 9223372036854775805
(+) -<FC>8 0 = -<FC>8
(+) -<FC>8 1 = -9223372036854775807
(+) -<FC>8 -1 = 9223372036854775807
(+) -<FC>8 2 = -9223372036854775806
(+) -<FC>8 -2 = 9223372036854775806
(+) -<FC>8 -<FC>8 = 0
(+) -<FC>8 9223372036854775807 = -1
(+) 9223372036854775807 0 = 9223372036854775807
(+) 9223372036854775807 1 = -<FC>8
(+) 9223372036854775807 -1 = 9223372036854775806
(+) 9223372036854775807 2 = -9223372036854775807
(+) 9223372036854775807 -2 = 9223372036854775805
(+) 9223372036854775807 -<FC>8 = -1
(+) 9223372036854775807 9223372036854775807 = -2
...
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1989#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs