summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen/should_run/T16449_2.hs
blob: 0a08ffde23477a57ef21d726066a4920ea17b099 (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.Op.ConstantFold.

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