id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
7600	cgrun044 failing with LLVM backend	dterei	dterei	"test case cgrun044 fails currently with the LLVM backend. I believe this started with the switch to the new-code-generator.

LLVM fails to compile the file due to an invalid floating point constant:

{{{
/Users/davidt/bin/opt: Bug31.ll:23:155: error: floating point constant invalid for type
@Bug31_floatzunumber_closure =  global %Bug31_floatzunumber_closure_struct<{i64 ptrtoint ([0 x i64]* @ghczmprim_GHCziTypes_Fzh_static_info to i64), float 0x7F800000, i32 0}>
}}}

This is an old, annoying bug needing to be fixed for about the third time. Basically, LLVM requires all floating points (float, doubles...) be printed in IEEE 754 Double format, even single precision numbers (float). However, it expects types labeled float to be representable in IEEE 754 Single precision format...

So what we do is store all floating point numbers as Double and then narrow those that are Float by trying to do 'Double -> Float -> Double'. Then we can use the same machinery to produce the output for LLVM.

Annoying, GHC seems to like to optimize away these narrowing operations. If it should or shouldn't do that is questionable. I'd argue it shouldn't, but oh well.

The new-code-generator seems to have defeated existing techniques for stopping the optimizer firing."	bug	closed	normal		Compiler (LLVM)	7.7	fixed			Unknown/Multiple	Unknown/Multiple	Compile-time crash	Unknown				3676
