[Git][ghc/ghc][master] Fix float parsing in GHC Cmm Lexer

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Dec 8 10:51:01 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
ca7510e4 by Malik Ammar Faisal at 2023-12-08T05:49:55-05:00
Fix float parsing in GHC Cmm Lexer

Add test case for bug #24224

- - - - -


4 changed files:

- compiler/GHC/Cmm/Lexer.x
- + testsuite/tests/cmm/should_compile/T24224.cmm
- + testsuite/tests/cmm/should_compile/T24224.stderr
- testsuite/tests/cmm/should_compile/all.T


Changes:

=====================================
compiler/GHC/Cmm/Lexer.x
=====================================
@@ -62,7 +62,7 @@ $namechar  = [$namebegin $digit]
 @hexadecimal = $hexit+
 @exponent    = [eE] [\-\+]? @decimal
 
- at floating_point = @decimal \. @decimal @exponent? | @decimal @exponent
+ at floating_point = [\-]? (@decimal \. @decimal @exponent? | @decimal @exponent)
 
 @escape      = \\ ([abfnrt\\\'\"\?] | x $hexit{1,2} | $octit{1,3})
 @strchar     = ($printable # [\"\\]) | @escape


=====================================
testsuite/tests/cmm/should_compile/T24224.cmm
=====================================
@@ -0,0 +1,3 @@
+main () {
+  float64 f1; f1 = (-1.0 :: float64);
+}


=====================================
testsuite/tests/cmm/should_compile/T24224.stderr
=====================================
@@ -0,0 +1,14 @@
+
+==================== Output Cmm ====================
+[main() { //  []
+         { info_tbls: []
+           stack_info: arg_space: 8
+         }
+     {offset
+       _lbl_:
+           __locVar_::F64 = -1.0 :: W64;
+           goto c2;
+     }
+ }]
+
+


=====================================
testsuite/tests/cmm/should_compile/all.T
=====================================
@@ -12,3 +12,4 @@ test('T16930', normal, makefile_test, ['T16930'])
 test('T17442', normal, compile, [''])
 test('T20725', normal, compile, ['-package ghc'])
 test('T23610', normal, makefile_test, ['T23610'])
+test('T24224', [cmm_src, grep_errmsg(r'(F64.*);', [1])], compile, ['-no-hs-main -ddump-cmm -dsuppress-all -dsuppress-uniques'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ca7510e4477fc37749a79dd6f77019684abbf140

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ca7510e4477fc37749a79dd6f77019684abbf140
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231208/fb87277f/attachment-0001.html>


More information about the ghc-commits mailing list