Skip to content

hsc2hs trouble with floating-point constants in cross-compilation mode

Split off from #7983.

GCC 4.6 rejects some uses of floating-point constants in the declaration of a local static array. From ticket:7983#comment:109626:

This is caused by a regression in GCC from gcc-4.4 to gcc-4.6: ​https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46028

$ cat Test_hsc_test0.c
void _hsc2hs_test1()
{
static int test_array[(89.) > 0 ? 2 : 1];
}

$ /usr/bin/gcc-4.4 -c ./Test_hsc_test0.c

$ /usr/bin/gcc-4.6 -c ./Test_hsc_test0.c
./Test_hsc_test0.c: In function ‘_hsc2hs_test1’:
./Test_hsc_test0.c:3:16: error: storage size of ‘test_array’ isn’t constant

This means that (if your C compiler is affected by this issue) hsc2hs can't handle

(#const 89.)

in cross-compilation mode.

Trac metadata
Trac field Value
Version 7.8.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component hsc2hs
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information