Opened 2 years ago

Last modified 13 months ago

#6037 new bug

Compile-time crash with sources with non-representable unicode characters

Reported by: akio Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.4.1
Keywords: Cc: pho@…, dagitj@…, hackage.haskell.org@…
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: T6037 Blocked By:
Blocking: Related Tickets:

Description

The following file causes GHC to crash, if compiled in the "C" locale.

$ LC_ALL=C ghc unicode.hs
[1 of 1] Compiling Foo              ( unicode.hs, unicode.o )

unicode.hs:2:1:
    Warning: Pattern match(es) are overlapped
             In an equation for `<stderr>: hPutChar: invalid argument (invalid character)

unicode.hs:

module Foo where
δ x = 3
δ x = 4

Change History (6)

comment:1 Changed 2 years ago by simonmar

  • Difficulty set to Unknown
  • Milestone set to 7.6.1

I suppose we should be using an encoding that does character translation rather than failing for a Unicode character that is not supported by the current locale.

comment:2 Changed 2 years ago by PHO

  • Cc pho@… added

comment:3 Changed 19 months ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:4 Changed 14 months ago by igloo

  • Milestone changed from 7.6.2 to 7.8.1
  • Test Case set to T6037

I think that we want to do something along the lines of:

enc <- mkIconvEncoding TransliterateCodingFailure localeEncodingName
hSetEncoding stdout enc
hSetEncoding stderr enc

but that means using internal modules, doing different things on different platforms, etc.

Instead: I think we should be able to just do:

hSetEncodingFailureMode stdout TransliterateCodingFailure
hSetEncodingFailureMode stderr TransliterateCodingFailure

I've added a test.

comment:5 Changed 14 months ago by dagit

  • Cc dagitj@… added

comment:6 Changed 13 months ago by liyang

  • Cc hackage.haskell.org@… added
Note: See TracTickets for help on using tickets.