Latest MT4 update 1421 has a very SERIOUS BUG!!! - page 3

 

This is guest CPU (virtual)
Do you know host CPU (physical)?

try this code please

#import "test.dll"
double fround(double x);
#import

#define PRN(expr) Print(#expr "=",expr);

input double X=1.23;

void OnStart()
  {
   PRN(fround(X));
   PRN(MathRound(X));
   PRN(MathFloor(X+0.5));
  }
 

i have problem with this:

This is the client server.

he reported that some program functions do not work.

Using tests, we found out that the MathRound functions do not work

Files:
 

We try to understand what is going wrong

Why I ask about physical CPU, cos it might have a bug.

our bug report to Apple for example

Incorrect behavior of instruction 'movzx r32, r16' prefixed with 0x66 in Rosetta2
Tested on MacBook Pro, Apple M1, macOS Monterey (version 12.5).
In Rosetta 2, instruction 'movzx r32,r16' prefixed with 0x66 sets the high bits (from 16 up to 63) of a destination register to zero.
The 0x66 prefix lowers destination register from 32 to 16 bit and, for example, instruction 'movzx AX,AX' looks like a NOP instruction on Intel and AMD processors. But when executed in Rosetta2, the high bits of AX register (from 16 up to 63) are zeroed, which subsequently leads to a fatal error (for example, memory access violation).

Code to reproduce the behavior:

unsigned long long __attribute((optnone)) func(void) {

   unsigned long long res;

   __asm (
      ".intel_syntax\n"

      "mov rax,-1\n"
      ".byte 0x66\n"
      "movzx eax,ax\n"
      : "=a" (res)
   );

   return(res);
}

int main(int argc,char *argv[]) {
   printf("\nbefore movzx: %I64x\nafter movzx: %I64x\n",~0ull,func());
   return(0);
}

Please find attached the full project.
To compile we used xcode 13.3 (13E113)
clang --version
Apple clang version 13.1.6 (clang-1316.0.21.2)

The behavior on Intel and AMD under Window 11:

before movzx: ffffffffffffffff
after movzx: ffffffffffffffff

The same result on MacBook Pro, Intel Core i7, macOS Monterey (version 12.5)

before movzx: ffffffffffffffff
after movzx: ffffffffffffffff


But when we execute in Rosetta2 on MacBook Pro, Apple M1, macOS Monterey (version 12.5), we get the following result:

before movzx: ffffffffffffffff
after movzx: ffff

The higher bit of registry was zeroed: significant bits only remained on lower 16 bits while others were set to zero.


 
Ilyas #:

This is guest CPU (virtual)
Do you know host CPU (physical)?

try this code please



Sorry for the late reply.
I was hoping to have an answer to your question regarding the host computers (physical) CPU - but my VPS hosting site has not yet responded fully.
I'll get back to you when they do, until then, here is the result of your recent code.
 
Ilyas #:
Could you give us more details about your PC

your CPU
your OS

is it Virtual Machine?

I don't think CPU (virtual or physical) matter here. Any computer's CPU should make a correct calculation.

The problem here is the code of new update version of MT4 platform.

Just try to call MathRound() function on new update version and you will see.
 
Vu Trung Kien #:

I don't think CPU (virtual or physical) matter here. Any computer's CPU should make a correct calculation.

The problem here is the code of new update version of MT4 platform.

Just try to call MathRound() function on new update version and you will see.
I believe that he’s an developer for MetaQoutes.
He’s trying to figure out the problem, since build 1421 works fine on most Windows OS, but seems to malfunction only on Server Windows or other specific hardware running different operating systems.
 
Ilyas #:

This is guest CPU (virtual)
Do you know host CPU (physical)?

try this code please

I got this answer..

Hi carl , Intel Gold Series CPUs for example 6252N
Thanks

Not the best answer, but hope it helps!
 
Carl Emil Bograd #:
He’s trying to figure out the problem, since build 1421 works fine on most Windows OS, but seems to malfunction only on Server Windows or other specific hardware running different operating systems.

The problem occurs when Windows Server is running in KVM/QEMU and the VM is set to KVM64 or QEMU64 virtual CPU. The problem is not solved yet. Maybe specifying the VM CPU as 'host' or specifying the exact model might help, but it depends on the hosting provider.

 
Three users of my products have the same problem. However, my computer does not have this problem.
During testing, we found out that MathRound() resets the values, although probably not for all values.

Also, as I understand it, there is a problem with fabs() which is used in:

void CCanvas::LineAA(const int x1,const int y1,const int x2,const int y2,const uint clr,const uint style)
This function no longer draws lines.
 

MT5 has the same problem. Expert Advisors with the MathRound and MathCeil functions do not work on the windows server 


PM      0       01:31:41.066    Terminal        Windows Server 2022 build 20348 on KVM, 4 x AMD EPYC 7282 16-Core, AVX2, 3 / 5 Gb memory, 384 / 399 Gb disk, RDP, UAC, admin, GMT+9