Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005824OCamlOCaml backend (code generation)public2012-11-14 12:222012-11-17 18:33
Reporterchambart 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.01.0+dev 
Summary0005824: [patch] avoid tagging integers before right shifting it
DescriptionWhen right shifting a value, the rightmost bit can be ignored:

let f a =
  (a lsl 3) lsr 2

is compiled as:

(or (>>u (+ (<< (+ a/1009 -1) 3) 1) 2) 1))

but could be:

(or (>>u (<< (+ a/1009 -1) 3) 2) 1))
TagsNo tags attached.
Attached Filespatch file icon 0001-Avoid-tagging-before-right-shifting.patch [^] (1,835 bytes) 2012-11-14 12:22 [Show Content]

- Relationships

-  Notes
(0008521)
xleroy (administrator)
2012-11-17 18:33

Well spotted. Patch applied in trunk, revision 13096. Note that the checks "n > 0" in lsr_int and asr_int are probably unnecessary, since the code generated by Plsrint and Pasrint always does an "or 1" afterwards, restoring the correct tag bit even if n = 0. But n = 0 never happens in well-written code, so we can be conservative.

- Issue History
Date Modified Username Field Change
2012-11-14 12:22 chambart New Issue
2012-11-14 12:22 chambart File Added: 0001-Avoid-tagging-before-right-shifting.patch
2012-11-17 18:33 xleroy Note Added: 0008521
2012-11-17 18:33 xleroy Status new => resolved
2012-11-17 18:33 xleroy Resolution open => fixed
2012-11-17 18:33 xleroy Fixed in Version => 4.01.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker