You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hsc2hs does not seem to place a limit on how long the "tokens" it produces while parsing can be. Consequently, they can easily result in the generated C code containing string literals which exceed the 4095 character limit which ISO C99 compilers are required to support.
This is the case when running hsc2hs on the attached Test.hsc file. Running hsc2hs Test.hsc does indeed produce a Test_hsc_make.c file with over-long literals. (Adding --cflag=-pedantic to the invocation makes this more obvious.)
I tried the same thing on the "Lens.Micro" source file from the microlens package (first renaming it from Micro.hs to Micro.hsc), and confirmed this occurs with that file, too - so literals of that length certainly occur in existing packages.
The cause seems to be that the length of tokens produced by the text Parser in HSCParser.hs is never checked.
Even if this isn't regarded as a bug, it might be helpful to note in the documentation that the output of hsc2hs may be non-portable C.
The text was updated successfully, but these errors were encountered:
hsc2hs does not seem to place a limit on how long the "tokens" it produces while parsing can be. Consequently, they can easily result in the generated C code containing string literals which exceed the 4095 character limit which ISO C99 compilers are required to support.
This is the case when running hsc2hs on the attached Test.hsc file. Running
hsc2hs Test.hsc
does indeed produce aTest_hsc_make.c
file with over-long literals. (Adding--cflag=-pedantic
to the invocation makes this more obvious.)I tried the same thing on the "Lens.Micro" source file from the microlens package (first renaming it from Micro.hs to Micro.hsc), and confirmed this occurs with that file, too - so literals of that length certainly occur in existing packages.
The cause seems to be that the length of tokens produced by the
text
Parser in HSCParser.hs is never checked.Even if this isn't regarded as a bug, it might be helpful to note in the documentation that the output of hsc2hs may be non-portable C.
The text was updated successfully, but these errors were encountered: