Mercury Bugs - mercury
View Issue Details
0000342mercuryBugpublic2014-06-24 16:032014-06-25 16:39
Reporterjuliensf 
Assigned Tojuliensf 
PriorityurgentSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000342: string.format broken in non-C grades
DescriptionThe attached program should print "16.0"; when using the Mercury implementation of format
(i.e when using_sprintf returns false), it prints "10.0". This affects all of the non-C backends.
TagsNo tags attached.
Attached Files? fmt_bug.m (284) 2014-06-24 16:03
https://bugs.mercurylang.org/file_download.php?file_id=217&type=bug

Notes
(0000706)
juliensf   
2014-06-24 16:05   
This is derived from tests/general/float_test and appears to be the reason for the failure of that
test with non-C backends.
(0000707)
juliensf   
2014-06-24 16:14   
The strings above should be "16" and "10" respectively.
(0000708)
wangp   
2014-06-24 16:31   
At least part of the bug can be attributed to commit b1af59cb29ac31db9fc5b3422fced505facabad1
where the replacement of string.substring was replaced by string.between incorrectly.
(0000709)
juliensf   
2014-06-24 16:54   
Yes, that commit introduced an off-by-one error at string.m:4038. Fixing that fixes the problem.
I'll commit a fix after I run some further tests to see if anything else is broken.
(0000710)
juliensf   
2014-06-25 16:39   
Fix committed.

Issue History
2014-06-24 16:03juliensfNew Issue
2014-06-24 16:03juliensfFile Added: fmt_bug.m
2014-06-24 16:05juliensfNote Added: 0000706
2014-06-24 16:14juliensfNote Added: 0000707
2014-06-24 16:31wangpNote Added: 0000708
2014-06-24 16:54juliensfNote Added: 0000709
2014-06-25 16:39juliensfNote Added: 0000710
2014-06-25 16:39juliensfStatusnew => resolved
2014-06-25 16:39juliensfResolutionopen => fixed
2014-06-25 16:39juliensfAssigned To => juliensf