summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/T16449_2.hs
blob: de461ab438b6eed18baefd90c2816f2a300bb211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
{-# LANGUAGE MagicHash #-}

module Main where

import GHC.Prim
import GHC.Int

-- Test that large unchecked shifts, which constitute undefined behavior, do
-- not crash the compiler and instead evaluate to 0.
-- See Note [Guarding against silly shifts] in GHC.Core.Opt.ConstantFold.

-- Shift should be larger than the word size (e.g. 64 on 64-bit) for this test.
main = print (I# (uncheckedIShiftL# 1# 1000#))