FastString: fix eager reading of string ptr in hashStr

This read causes NULL dereferencing when len is 0.

Fixes #17909

In the reproducer in #17909 this bug is triggered as follows:

- SimplOpt.dealWithStringLiteral is called with a single-char string
  ("=" in #17909)

- tailFS gets called on the FastString of the single-char string.

- tailFS checks the length of the string, which is 1, and calls
  mkFastStringByteString on the tail of the ByteString, which is an
  empty ByteString as the original ByteString has only one char.

- ByteString's unsafeUseAsCStringLen returns (NULL, 0) for the empty
  ByteString, which is passed to mkFastStringWith.

- mkFastStringWith gets hash of the NULL pointer via hashStr, which
  fails on empty strings because of this bug.
23 jobs for master in 383 minutes and 38 seconds (queued for 7 seconds)
Status Job ID Name Coverage
  Lint
passed #286687
lint
lint-linters

00:00:13

passed #286690
lint
lint-submods-branch

00:00:16

passed #286688
lint
lint-testsuite

00:00:15

passed #286689
lint
typecheck-testsuite

00:00:14

 
  Quick Build
passed #286691
x86_64-linux
hadrian-ghc-in-ghci

00:08:27

 
  Build
passed #286692
x86_64-linux
validate-x86_64-linux-deb9-hadrian

01:33:14

 
  Full Build
failed #286695
aarch64-linux allowed to fail
validate-aarch64-linux-deb9

04:11:13

passed #286696
armv7-linux
validate-armv7-linux-deb9

03:53:37

passed #286697
x86_64-linux
validate-i386-linux-deb9

01:03:39

failed #286704
new-x86_64-windows test allowed to fail
validate-i386-windows

passed #286694
x86_64-darwin
validate-x86_64-darwin

01:11:42

passed #286698
x86_64-linux
validate-x86_64-linux-deb9-debug

02:18:17

passed #286700
x86_64-linux
validate-x86_64-linux-deb9-dwarf

02:17:48

passed #286699
x86_64-linux
validate-x86_64-linux-deb9-integer-simple

01:20:19

passed #286693
x86_64-linux
validate-x86_64-linux-deb9-unreg-hadrian

04:12:28

passed #286701
x86_64-linux
validate-x86_64-linux-fedora27

01:30:53

failed #286703
new-x86_64-windows test allowed to fail
validate-x86_64-windows

failed #286702
new-x86_64-windows test allowed to fail
validate-x86_64-windows-hadrian

 
  Cleanup
passed #286705
x86_64-darwin
cleanup-darwin

00:00:15

 
  Packaging
failed #286706
x86_64-linux allowed to fail
doc-tarball

00:02:56

 
  Testing
manual #286707
x86_64-linux allowed to fail manual
hackage
passed #286708
x86_64-linux
perf-nofib

00:22:19

 
  Deploy
failed #286709
x86_64-linux allowed to fail
pages

00:03:24

 
Name Stage Failure
failed
validate-x86_64-windows Full Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
pages Deploy
Entering 'libraries/xhtml'
Entering 'nofib'
Entering 'utils/haddock'
Entering 'utils/hsc2hs'
$ mkdir -p public/doc
$ tar -xf haddock.html.tar.xz -C public/doc
tar: haddock.html.tar.xz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows-hadrian Full Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
validate-i386-windows Full Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
validate-aarch64-linux-deb9 Full Build
Uploading artifacts...
ghc-aarch64-linux-deb9.tar.xz: found 1 matching files
junit.xml: found 1 matching files

performance-metrics.tsv: found 1 matching files

Uploading artifacts to coordinator... ok
id=286695 responseStatus=201 Created token=kJ1_gymp
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=286695 responseStatus=201 Created token=kJ1_gymp
ERROR: Job failed: exit code 1
failed
doc-tarball Packaging
Entering 'libraries/xhtml'
Entering 'nofib'
Entering 'utils/haddock'
Entering 'utils/hsc2hs'
Downloading artifacts for validate-x86_64-linux-deb9-debug (286698)...
Downloading artifacts from coordinator... ok id=286698 responseStatus=200 OK token=tjRnjjBf
$ if [ ! -f "$LINUX_BINDIST" ]; then # collapsed multi-line command
Error: ghc-x86_64-mingw32.tar.xz does not exist. Did the 64-bit Windows job fail?
ERROR: Job failed: exit code 1