Modify

Opened 23 months ago

Last modified 3 months ago

#4007 assigned Bug

Inconsistent pointer arithmetic

Reported by: Pickwy Owned by: Jon
Milestone: Component: AutoIt
Version: 3.3.16.1 Severity: None
Keywords: pointer math arithmetic Cc: admin@…

Description

Pointers have several inconsistencies during mathematical operations, some of which should be considered bugs :

Local $Test1 = Ptr(1) + 1
ConsoleWrite(VarGetType($Test1) & @CRLF) ;Print "Ptr" (OK)
Local $Test2 = 1 + Ptr(1)
ConsoleWrite(VarGetType($Test2) & @CRLF) ;Print "Double" (Expected : "Ptr")

Local $Test3 = Ptr(1) + Ptr(1)
ConsoleWrite($Test3 & @CRLF) ;Print "0x0000000000000002" (OK)

Local $Test4 = Ptr(2) - Ptr(1)
ConsoleWrite($Test4 & @CRLF) ;Print "0x0000000000000001" (OK)

Local $Test5 = Ptr(3) * Ptr(2)
ConsoleWrite($Test5 & @CRLF) ;Print "0x0000000000000003" (Expected : "0x0000000000000006")

Local $Test6 = Ptr(4) / Ptr(2)
ConsoleWrite($Test6 & @CRLF) ;Print "0x0000000000000004" (Expected : "0x0000000000000002")

Attachments (0)

Change History (2)

comment:1 by Pickwy, 23 months ago

Some other variant type have the same strange behavior like the Default keyword :
Default + (Int32)2 = (Double)1
Default - (Int32)2 = (Int32)-2
Default * (Int32)2 = Default
Default / (Int32)2 = Default

comment:2 by J-Paul Mesnage, 3 months ago

Owner: set to Jon
Status: newassigned

Fix sent to Jon

Modify Ticket

Action
as assigned The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.