stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
140 stars 44 forks source link

Handle leading zeros in scientific notation literals #1336

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

I'm performing some fuzzing for #1100 and it found this bug which exists independently of that PR. The AST to MIR translation currently avoids trimming a leading zero if the next character is e or ., but not E, leading to (in this case) failures in the partial evaluator at --O1.

Submission Checklist

Release notes

Fixed an issue with leading zeroes in real literals like 0E0

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

codecov[bot] commented 1 year ago

Codecov Report

Merging #1336 (20c3078) into master (464e4dc) will not change coverage. The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master    #1336   +/-   ##
=======================================
  Coverage   88.77%   88.77%           
=======================================
  Files          64       64           
  Lines        9873     9873           
=======================================
  Hits         8765     8765           
  Misses       1108     1108           
Impacted Files Coverage Δ
src/frontend/Ast_to_Mir.ml 92.25% <0.00%> (ø)