Opened 3 years ago

Last modified 5 weeks ago

#6037 new bug

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

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

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 (9)

comment:1 Changed 3 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 3 years ago by PHO

  • Cc pho@… added

comment:3 Changed 3 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:4 Changed 2 years 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 2 years ago by dagit

  • Cc dagitj@… added

comment:6 Changed 2 years ago by liyang

  • Cc hackage.haskell.org@… added

comment:7 Changed 14 months ago by thoughtpolice

  • Milestone changed from 7.8.3 to 7.10.1

Moving to 7.10.1.

comment:8 Changed 7 months ago by thoughtpolice

  • Milestone changed from 7.10.1 to 7.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:9 Changed 5 weeks ago by RyanGlScott

  • Cc RyanGlScott added
Note: See TracTickets for help on using tickets.