GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2022-05-26T15:03:53Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/21612ghc-stage1 failed to compile Win32 due to "File does not match module name" i...2022-05-26T15:03:53ZCarrieMYghc-stage1 failed to compile Win32 due to "File does not match module name" in `Pen.hs`## Summary
I encountered this problem when building latest ghc master branch by `make`. (I am sorry for not adopting `hadrian` yet because there I also got troubles which I will seek help else where.) If additional information is needed,...## Summary
I encountered this problem when building latest ghc master branch by `make`. (I am sorry for not adopting `hadrian` yet because there I also got troubles which I will seek help else where.) If additional information is needed, please let me know. Thanks!
## Steps to reproduce
./boot && ./configure --enable-autodownload-tarballs && make
```
... messages omitted ...
"rm" -f libraries/Win32/dist-install/build/.depend-v.haskell.tmp
"inplace/bin/ghc-stage1.exe" -M -static -O0 -H64m -Wall -this-unit-id Win32-2.12.0.0 -hide-all-packages -package-env - -i -ilibraries/Win32/. -ilibraries/Win32/dist-install/build -Ilibraries/Win32/dist-install/build -ilibraries/Win32/dist-install/build/./autogen -Ilibraries/Win32/dist-install/build/./autogen -Ilibraries/Win32/include -Ilibraries/Win32/dist-install/build/include -optP-include -optPlibraries/Win32/dist-install/build/./autogen/cabal_macros.h -package-id base-4.16.0.0 -package-id filepath-1.4.2.1 -Wall -fno-warn-name-shadowing -Wall -XHaskell2010 -XForeignFunctionInterface -XCPP -XNondecreasingIndentation -O -no-user-package-db -rtsopts -Wno-trustworthy-safe -Wno-deprecated-flags -Wnoncanonical-monad-instances -outputdir libraries/Win32/dist-install/build -dep-makefile libraries/Win32/dist-install/build/.depend-v.haskell.tmp -dep-suffix "" -include-pkg-deps libraries/Win32/./Graphics/Win32/GDI.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Bitmap.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Brush.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Clip.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Font.hs libraries/Win32/./Graphics/Win32/GDI/Graphics2D.hs libraries/Win32/./Graphics/Win32/GDI/HDC.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Palette.hs libraries/Win32/./Graphics/Win32/GDI/Path.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Pen.hs libraries/Win32/./Graphics/Win32/GDI/Region.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/Types.hs libraries/Win32/./Graphics/Win32.hs libraries/Win32/dist-install/build/Graphics/Win32/Control.hs libraries/Win32/dist-install/build/Graphics/Win32/Dialogue.hs libraries/Win32/./Graphics/Win32/Icon.hs libraries/Win32/dist-install/build/Graphics/Win32/Key.hs libraries/Win32/dist-install/build/Graphics/Win32/Menu.hs libraries/Win32/dist-install/build/Graphics/Win32/Message.hs libraries/Win32/dist-install/build/Graphics/Win32/Misc.hs libraries/Win32/dist-install/build/Graphics/Win32/Resource.hs libraries/Win32/dist-install/build/Graphics/Win32/Window.hs libraries/Win32/dist-install/build/Graphics/Win32/LayeredWindow.hs libraries/Win32/dist-install/build/Graphics/Win32/GDI/AlphaBlend.hs libraries/Win32/dist-install/build/Graphics/Win32/Window/AnimateWindow.hs libraries/Win32/dist-install/build/Graphics/Win32/Window/HotKey.hs libraries/Win32/dist-install/build/Graphics/Win32/Window/IMM.hs libraries/Win32/./Graphics/Win32/Window/ForegroundWindow.hs libraries/Win32/dist-install/build/Graphics/Win32/Window/PostMessage.hs libraries/Win32/./Media/Win32.hs libraries/Win32/./System/Win32.hs libraries/Win32/dist-install/build/System/Win32/DebugApi.hs libraries/Win32/dist-install/build/System/Win32/DLL.hs libraries/Win32/dist-install/build/System/Win32/Event.hs libraries/Win32/dist-install/build/System/Win32/File.hs libraries/Win32/dist-install/build/System/Win32/FileMapping.hs libraries/Win32/dist-install/build/System/Win32/Info.hs libraries/Win32/dist-install/build/System/Win32/Path.hs libraries/Win32/dist-install/build/System/Win32/Mem.hs libraries/Win32/dist-install/build/System/Win32/MinTTY.hs libraries/Win32/dist-install/build/System/Win32/NLS.hs libraries/Win32/dist-install/build/System/Win32/Process.hs libraries/Win32/dist-install/build/System/Win32/Registry.hs libraries/Win32/dist-install/build/System/Win32/SimpleMAPI.hs libraries/Win32/dist-install/build/System/Win32/Time.hs libraries/Win32/dist-install/build/System/Win32/Console.hs libraries/Win32/dist-install/build/System/Win32/Security.hs libraries/Win32/dist-install/build/System/Win32/Types.hs libraries/Win32/dist-install/build/System/Win32/Shell.hs libraries/Win32/./System/Win32/Automation.hs libraries/Win32/dist-install/build/System/Win32/Automation/Input.hs libraries/Win32/dist-install/build/System/Win32/Automation/Input/Key.hs libraries/Win32/dist-install/build/System/Win32/Automation/Input/Mouse.hs libraries/Win32/./System/Win32/Console/CtrlHandler.hs libraries/Win32/./System/Win32/Console/HWND.hs libraries/Win32/dist-install/build/System/Win32/Console/Title.hs libraries/Win32/./System/Win32/Encoding.hs libraries/Win32/./System/Win32/Exception/Unsupported.hs libraries/Win32/./System/Win32/HardLink.hs libraries/Win32/dist-install/build/System/Win32/Info/Computer.hs libraries/Win32/dist-install/build/System/Win32/Info/Version.hs libraries/Win32/./System/Win32/String.hs libraries/Win32/dist-install/build/System/Win32/SymbolicLink.hs libraries/Win32/./System/Win32/Thread.hs libraries/Win32/./System/Win32/Utils.hs libraries/Win32/./System/Win32/Word.hs
libraries\Win32\dist-install\build\Graphics\Win32\GDI\Pen.hs:1:1: error:
File name does not match module name:
Saw : ‘Main’
Expected: ‘Graphics.Win32.GDI.Pen’
libraries/Win32/ghc.mk:4: libraries/Win32/dist-install/build/.depend-v.haskell: No such file or directory
make[1]: *** [libraries/Win32/ghc.mk:5: libraries/Win32/dist-install/build/.depend-v.haskell] Error 1
make: *** [Makefile:128: all] Error 2
```
## Environment
* GHC version used: master (commit 36b8a57cb)
Optional:
* Operating System: Windows (Msys2)
* System Architecture: x86_64https://gitlab.haskell.org/ghc/ghc/-/issues/20393hsc2hs's C compiler invocations are problematic2022-03-08T14:47:33ZBen Gamarihsc2hs's C compiler invocations are problematicCurrently `hsc2hs` invokes `ld` and `cc` itself, allowing the commands and arguments to be specified via its `--cc`, `--cflag`, `--ld`, and `--ldflag` options. This design is problematic since it introduces the possibility for inconsiste...Currently `hsc2hs` invokes `ld` and `cc` itself, allowing the commands and arguments to be specified via its `--cc`, `--cflag`, `--ld`, and `--ldflag` options. This design is problematic since it introduces the possibility for inconsistency between the toolchain used by `hsc2hs` and that used by GHC itself. This has already bitten us in the case of Darwin (see !6236) and will certainly bite us further once we have #19877.
Frankly, I don't see why `hsc2hs` should be calling `cc` at all; it seems like it would be generally easier if it rather simply used GHC to drive compilation and linking, giving us a single point of configuration.ZubinZubinhttps://gitlab.haskell.org/ghc/ghc/-/issues/17995Incorrect version of hsc2hs shipped with GHC-8.8.*2020-06-20T21:37:08ZKirill ZaborskyIncorrect version of hsc2hs shipped with GHC-8.8.*## Summary
GHc 8.8.* looks to include `hsc2hs` of version 0.68.6 but `hsc2hs --version` reports incorrect version 0.68.5
## Steps to reproduce
Described in https://github.com/qrilka/hsc2hs-fail#hsc2hs-shipped-with-ghc-88x-reports-wron...## Summary
GHc 8.8.* looks to include `hsc2hs` of version 0.68.6 but `hsc2hs --version` reports incorrect version 0.68.5
## Steps to reproduce
Described in https://github.com/qrilka/hsc2hs-fail#hsc2hs-shipped-with-ghc-88x-reports-wrong-version
## Expected behavior
`hsc2hs --version` reports 0.68.6 and the repro above doesn't fail building because of incorrect version
## Environment
* GHC version used: 8.8.3, 8.8.28.8.4https://gitlab.haskell.org/ghc/ghc/-/issues/13620hsc2hs parses incorrectly '#ifdef' under '#{enum' in '--cross-compile' mode2019-07-07T18:20:55ZSergei Trofimovichhsc2hs parses incorrectly '#ifdef' under '#{enum' in '--cross-compile' modeThe code is simplified version of something from Win32 package (https://github.com/haskell/win32/blob/master/System/Win32/SimpleMAPI.hsc\#L56):
```hs
#{enum Int ,
, a = sizeof(int)
#if 0
, b = sizeof(char)
#endif
}
```
`...The code is simplified version of something from Win32 package (https://github.com/haskell/win32/blob/master/System/Win32/SimpleMAPI.hsc\#L56):
```hs
#{enum Int ,
, a = sizeof(int)
#if 0
, b = sizeof(char)
#endif
}
```
```
$ hsc2hs b.hsc -o b.hs-native
$ hsc2hs b.hsc -o b.hs-cross --cross-compile
b.hsc:1 sizeof(int)
#if 0
is not an integer
```
I'm not sure if it's a valid .hsc but having at least the same (valid or invalid) result in both modes would be nice.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | Phyx-, hvr |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"hsc2hs parses incorrectly '#ifdef' under '#{enum' in '--cross-compile' mode","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["Phyx-","hvr"],"type":"Bug","description":"The code is simplified version of something from Win32 package (https://github.com/haskell/win32/blob/master/System/Win32/SimpleMAPI.hsc#L56):\r\n\r\n{{{#!hs\r\n#{enum Int ,\r\n , a = sizeof(int)\r\n#if 0\r\n , b = sizeof(char)\r\n#endif\r\n }\r\n}}}\r\n\r\n{{{\r\n$ hsc2hs b.hsc -o b.hs-native\r\n$ hsc2hs b.hsc -o b.hs-cross --cross-compile\r\nb.hsc:1 sizeof(int)\r\n#if 0\r\n is not an integer\r\n}}}\r\n\r\nI'm not sure if it's a valid .hsc but having at least the same (valid or invalid) result in both modes would be nice.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/13619hsc2hs parses incorrectly c99 style ("/// ...") comments in '--cross-compile'...2019-07-07T18:20:56ZSergei Trofimovichhsc2hs parses incorrectly c99 style ("/// ...") comments in '--cross-compile' modeThe code is simplified version of something from Win32 package
(https://github.com/haskell/win32/blob/master/Graphics/Win32/GDI/Pen.hsc\#L59):
```hs
-- a.hsc
#{enum Int , // "hi" there!
, a = sizeof(int)
}
```
```
$ hsc2hs ...The code is simplified version of something from Win32 package
(https://github.com/haskell/win32/blob/master/Graphics/Win32/GDI/Pen.hsc\#L59):
```hs
-- a.hsc
#{enum Int , // "hi" there!
, a = sizeof(int)
}
```
```
$ hsc2hs a.hsc -o a.hs-cross --cross-compile
$ hsc2hs a.hsc -o a.hs-native
```
```diff
--- a.hs-cross 2017-04-26 21:56:56.157323964 +0100
+++ a.hs-native 2017-04-26 21:57:00.753311717 +0100
@@ -2,3 +2,3 @@
a :: Int
-a = // "hi" there! 4
+a = 4
```
I'm not sure if it's a valid .hsc but having at least the same
(valid or invalid) result in both modes would be nice.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | Phyx-, hvr |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"hsc2hs parses incorrectly c99 style (\"/// ...\") comments in '--cross-compile' mode","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["Phyx-","hvr"],"type":"Bug","description":"The code is simplified version of something from Win32 package\r\n(https://github.com/haskell/win32/blob/master/Graphics/Win32/GDI/Pen.hsc#L59):\r\n\r\n{{{#!hs\r\n-- a.hsc\r\n#{enum Int , // \"hi\" there!\r\n , a = sizeof(int)\r\n }\r\n}}}\r\n\r\n{{{\r\n$ hsc2hs a.hsc -o a.hs-cross --cross-compile\r\n$ hsc2hs a.hsc -o a.hs-native\r\n}}}\r\n{{{#!diff\r\n--- a.hs-cross 2017-04-26 21:56:56.157323964 +0100\r\n+++ a.hs-native 2017-04-26 21:57:00.753311717 +0100\r\n@@ -2,3 +2,3 @@\r\n a :: Int\r\n-a = // \"hi\" there! 4\r\n+a = 4\r\n}}}\r\n\r\nI'm not sure if it's a valid .hsc but having at least the same\r\n(valid or invalid) result in both modes would be nice.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/12849hsc2hs trouble with floating-point constants in cross-compilation mode2021-11-10T13:28:50Zrwbartonhsc2hs trouble with floating-point constants in cross-compilation modeSplit 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](https://gitlab.haskell.org//ghc/ghc/issues/7983#note_109626):
> This is caused b...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](https://gitlab.haskell.org//ghc/ghc/issues/7983#note_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.
<details><summary>Trac metadata</summary>
| 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 | |
</details>
<!-- {"blocked_by":[],"summary":"hsc2hs trouble with floating-point constants in cross-compilation mode","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Split off from #7983.\r\n\r\nGCC 4.6 rejects some uses of floating-point constants in the declaration of a local static array. From ticket:7983#comment:5:\r\n\r\n> 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\r\n>\r\n> {{{\r\n> $ cat Test_hsc_test0.c\r\n> void _hsc2hs_test1()\r\n> {\r\n> static int test_array[(89.) > 0 ? 2 : 1];\r\n> }\r\n> \r\n> $ /usr/bin/gcc-4.4 -c ./Test_hsc_test0.c\r\n> \r\n> $ /usr/bin/gcc-4.6 -c ./Test_hsc_test0.c\r\n> ./Test_hsc_test0.c: In function ‘_hsc2hs_test1’:\r\n> ./Test_hsc_test0.c:3:16: error: storage size of ‘test_array’ isn’t constant\r\n> }}}\r\n\r\nThis means that (if your C compiler is affected by this issue) hsc2hs can't handle\r\n{{{\r\n(#const 89.)\r\n}}}\r\nin cross-compilation mode.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/12149Support bit-fields2022-12-04T17:01:55ZFacundo DomínguezSupport bit-fieldsHaving C type like:
```
typedef struct S {
int f0: 1;
int f1: 15;
} S;
```
and `hsc` code like
```
#{peek S, f0} p
```
Causes `hsc2hs` to fail with
```
error: attempt to take address of bit-field structure member 'f0'
```
Appar...Having C type like:
```
typedef struct S {
int f0: 1;
int f1: 15;
} S;
```
and `hsc` code like
```
#{peek S, f0} p
```
Causes `hsc2hs` to fail with
```
error: attempt to take address of bit-field structure member 'f0'
```
Apparently this is an error from gcc, which cannot provide the address of bit-fields. However, in Haskell we are not interested in the address of the bit-field but in its value.
It would be useful to have a way to get and set the values of these fields.
Some former discussion [here](https://mail.haskell.org/pipermail/haskell-cafe/2008-November/050317.html)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------- |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | mboes, qnikst |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Support bit-fields","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":["bit-fields"],"differentials":[],"test_case":"","architecture":"","cc":["mboes","qnikst"],"type":"Bug","description":"Having C type like:\r\n{{{\r\ntypedef struct S {\r\n int f0: 1;\r\n int f1: 15;\r\n} S;\r\n}}}\r\nand {{{hsc}}} code like\r\n{{{\r\n#{peek S, f0} p\r\n}}}\r\nCauses {{{hsc2hs}}} to fail with\r\n{{{\r\nerror: attempt to take address of bit-field structure member 'f0'\r\n}}}\r\nApparently this is an error from gcc, which cannot provide the address of bit-fields. However, in Haskell we are not interested in the address of the bit-field but in its value.\r\n\r\nIt would be useful to have a way to get and set the values of these fields.\r\n\r\nSome former discussion [https://mail.haskell.org/pipermail/haskell-cafe/2008-November/050317.html here]","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/9457hsc2hs breaks with `--cflag=-Werror` in cross-compilation mode2019-07-07T18:40:20Zrwbartonhsc2hs breaks with `--cflag=-Werror` in cross-compilation modeI would like to be able to do
```
config_args='--target=i386-unknown-linux --with-gcc=i386-unknown-linux-gcc' ./validate
```
to validate a 32-bit GHC on a 64-bit Linux system. (I don't know why I have to specify `--with-gcc` in additio...I would like to be able to do
```
config_args='--target=i386-unknown-linux --with-gcc=i386-unknown-linux-gcc' ./validate
```
to validate a 32-bit GHC on a 64-bit Linux system. (I don't know why I have to specify `--with-gcc` in addition to `--target`; an unrelated mystery.)
However `validate` sets `-Werror` and the C code that `hsc2hs` generates in cross-compilation mode is not always warning-free, e.g.,
```
Files.hsc: In function ‘_hsc2hs_test’:
Files.hsc:81:14: error: variable ‘test_array’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
```
so `hsc2hs` draws incorrect conclusions from its tests.
Either the `hsc2hs`-generated C code should be made (and kept) warning-free, or perhaps `hsc2hs` should append `-Wwarn` to the options that it passes to the C compiler.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.9 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"hsc2hs breaks with `--cflag=-Werror` in cross-compilation mode","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.9","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I would like to be able to do\r\n{{{\r\nconfig_args='--target=i386-unknown-linux --with-gcc=i386-unknown-linux-gcc' ./validate\r\n}}}\r\nto validate a 32-bit GHC on a 64-bit Linux system. (I don't know why I have to specify `--with-gcc` in addition to `--target`; an unrelated mystery.)\r\n\r\nHowever `validate` sets `-Werror` and the C code that `hsc2hs` generates in cross-compilation mode is not always warning-free, e.g.,\r\n{{{\r\nFiles.hsc: In function ‘_hsc2hs_test’:\r\nFiles.hsc:81:14: error: variable ‘test_array’ set but not used [-Werror=unused-but-set-variable]\r\ncc1: all warnings being treated as errors\r\n}}}\r\nso `hsc2hs` draws incorrect conclusions from its tests.\r\n\r\nEither the `hsc2hs`-generated C code should be made (and kept) warning-free, or perhaps `hsc2hs` should append `-Wwarn` to the options that it passes to the C compiler.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/8872hsc cast size warnings on 32-bit Linux2019-07-07T18:43:01ZMateusz Kowalczykhsc cast size warnings on 32-bit LinuxWhen compiling the gtk package with GHC 7.9.20140308 I get a bunch of warnings as outlined below. I'm on 32-bit system. Apparently this is something that should be reported.
```
In file included from dist/dist-sandbox-c4fc5f8b/build/Gra...When compiling the gtk package with GHC 7.9.20140308 I get a bunch of warnings as outlined below. I'm on 32-bit system. Apparently this is something that should be reported.
```
In file included from dist/dist-sandbox-c4fc5f8b/build/Graphics/UI/Gtk/General/Structs_hsc_make.c:1:0:
Structs.hsc: In function ‘main’:
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1020:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1020:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1025:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1025:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1029:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1029:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1033:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1033:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1037:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1037:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1042:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1042:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1046:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
^
Structs.hsc:1046:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%lld", (long long)(x)); \
^
Structs.hsc:1051:5: note: in expansion of macro ‘hsc_const’
/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
hsc_printf ("%llu", (unsigned long long)(x));
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.9 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | Unknown/Multiple |
</details>
<!-- {"blocked_by":[],"summary":"hsc cast size warnings on 32-bit Linux","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.9","keywords":[],"differentials":[],"test_case":"","architecture":"Unknown/Multiple","cc":[""],"type":"Bug","description":"When compiling the gtk package with GHC 7.9.20140308 I get a bunch of warnings as outlined below. I'm on 32-bit system. Apparently this is something that should be reported.\r\n\r\n{{{\r\nIn file included from dist/dist-sandbox-c4fc5f8b/build/Graphics/UI/Gtk/General/Structs_hsc_make.c:1:0:\r\nStructs.hsc: In function ‘main’:\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1020:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1020:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1025:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1025:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1029:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1029:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1033:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1033:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1037:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1037:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1042:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1042:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1046:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n ^\r\nStructs.hsc:1046:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:36:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%lld\", (long long)(x)); \\\r\n ^\r\nStructs.hsc:1051:5: note: in expansion of macro ‘hsc_const’\r\n/home/shana/ghc-20140308/lib/ghc-7.9.20140308/template-hsc.h:38:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]\r\n hsc_printf (\"%llu\", (unsigned long long)(x));\r\n\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/7983Bug in hsc2hs --cross-safe2019-07-07T18:47:10ZsingpolymaBug in hsc2hs --cross-safeThe following test succeeds with hsc2hs --cross-safe but fails with hsc2hs --cross-compile:
```
#include <unicode/uchar.h>
(#const U_NO_NUMERIC_VALUE)
```
For reference, the define being used is:
```
#define U_NO_NUMERIC_VALUE ((doub...The following test succeeds with hsc2hs --cross-safe but fails with hsc2hs --cross-compile:
```
#include <unicode/uchar.h>
(#const U_NO_NUMERIC_VALUE)
```
For reference, the define being used is:
```
#define U_NO_NUMERIC_VALUE ((double)-123456789.)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Bug in hsc2hs --cross-safe","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.6.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following test succeeds with hsc2hs --cross-safe but fails with hsc2hs --cross-compile:\r\n\r\n{{{\r\n#include <unicode/uchar.h>\r\n\r\n(#const U_NO_NUMERIC_VALUE)\r\n}}}\r\n\r\nFor reference, the define being used is:\r\n\r\n{{{\r\n#define U_NO_NUMERIC_VALUE ((double)-123456789.)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1https://gitlab.haskell.org/ghc/ghc/-/issues/5918hsc2hs forces wordsize (i.e. -m32 or -m64) to be the choice of GHC instead of...2019-07-07T18:53:00Zatzehsc2hs forces wordsize (i.e. -m32 or -m64) to be the choice of GHC instead of allowing a different (or no/default choice)I am not sure whether to call this a bug as it does not cause a failure of GHC but a failure of UHC which also uses hsc2hs.
The problem occurs when UHC builds for a different wordsize than GHC, in particular UHC 64 bits, GHC 32 bits. Th...I am not sure whether to call this a bug as it does not cause a failure of GHC but a failure of UHC which also uses hsc2hs.
The problem occurs when UHC builds for a different wordsize than GHC, in particular UHC 64 bits, GHC 32 bits. The wrapper then forces -m32 when running hsc2hs via the environment variable HSC2HS_EXTRA. This cannot be turned off. A (temporary) solution is to uncomment the following lines in the wrapper script /usr/bin/hsc2hs:
```
# -c*) HSC2HS_EXTRA=;;
# --cc=*) HSC2HS_EXTRA=;;
```
This turns off the extra flags when a C compiler is explicitly specified, amongst which the -m32, and just lets the user define (or not define) the required flags when another compiler is explicitly used.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | hsc2hs |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"hsc2hs forces wordsize (i.e. -m32 or -m64) to be the choice of GHC instead of allowing a different (or no/default choice)","status":"New","operating_system":"","component":"hsc2hs","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I am not sure whether to call this a bug as it does not cause a failure of GHC but a failure of UHC which also uses hsc2hs.\r\n\r\nThe problem occurs when UHC builds for a different wordsize than GHC, in particular UHC 64 bits, GHC 32 bits. The wrapper then forces -m32 when running hsc2hs via the environment variable HSC2HS_EXTRA. This cannot be turned off. A (temporary) solution is to uncomment the following lines in the wrapper script /usr/bin/hsc2hs:\r\n\r\n\r\n{{{\r\n# -c*) HSC2HS_EXTRA=;;\r\n# --cc=*) HSC2HS_EXTRA=;;\r\n}}}\r\n\r\nThis turns off the extra flags when a C compiler is explicitly specified, amongst which the -m32, and just lets the user define (or not define) the required flags when another compiler is explicitly used.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1