Issues

Select view

Select search mode

 
34 of 34

bytecode differs depending on if precise math is enabled

Fixed

Description

After switching back to precise mode being off by default, the following tests started to fail

It seems different byte code is generated depending on the setting of precise mode

 

both tests use application action="update" preciseMath=true;

https://github.com/lucee/Lucee/blob/6.2/test/functions/BitXor.cfc#L50

https://github.com/lucee/Lucee/blob/6.2/test/functions/BitOr.cfc#L58

but the bytecode differs depending on if the number is passed as a string or number

as number it’s LiteralValue.toNumber(paramPageContext, Long.MAX_VALUE)

as string, it’s LiteralValue.toNumber(paramPageContext, "9223372036854778000")

Environment

None

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Created 12 December 2024 at 13:38
Updated 15 March 2025 at 14:02
Resolved 17 December 2024 at 12:30

Activity

Show:

Pothys - MitrahSoft17 December 2024 at 12:30
Edited

, I tested this ticket with Lucee version 6.2.0.218-SNAPSHOT. When I ran BitXor() and BitOr() with preciseMath set to false in admin mode, now return the expected results and work fine

Michael Offner13 December 2024 at 10:30

Lucee 6.2

Michael Offner13 December 2024 at 10:28

solution is to exclude the “preciseMath“ setting from any compiler decision, so the result from the compiler works independent of that settings, of course still with the limitation that settings brings.

Michael Offner13 December 2024 at 09:43

problem is that Lucee compiler detects, that you pass a literal string into a function takes a number as argument, so the compiler already optimizes and convert the string already to a Number at compilation time what causes an overflow.

Flag notifications