Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Language    [ Add a report in this area ]  
Report #:  99377   Status: Closed
Little bug in Win64 Mode - old style, 'Object' type.
Project:  Delphi Build #:  16.0.4256.43595
Version:    16.0 Submitted By:   Babak Yaghoobi
Report Type:  Crash / Data loss / Total failure Date Reported:  9/27/2011 9:33:13 AM
Severity:    Commonly encountered problem Last Updated: 12/19/2012 7:22:32 PM
Platform:    All versions Internal Tracking #:   287905
Resolution: Fixed (Resolution Comments) Resolved in Build: : Update 3
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 6
Description
Added by Sysop
<<<<
This issue is similar to QC#98448(Internal#285067).
>>>>

I found a bad bug in Win64 mode,
----------
Access Violation Error.
Project ObjectTest.exe raised exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.
----------

But work fine Win32 Mode.
See Sample

Program ObjectTest;

Type
  BaseObj = Object
    Constructor Create;
    Procedure P1; virtual ; // If Remove Virtual Not Exception In Call P1 Only Exception in v := 12.0
  End;

  SecObj = Object( BaseObj )
    Var v: Double ;
    Procedure P1; virtual ; // If Remove Virtual Not Exception In Call P1 Only Exception in v := 12.0
  End;

Type
  BaseClass = Class
    Private
      MyObj: BaseObj;

  End;

Constructor BaseObj.Create;
Begin
  { }
End;

Procedure BaseObj.P1;
Begin
End;

Procedure SecObj.P1;
Begin
  inherited ;
  V := 12.0 ; // <----- Raise Exception This Line ( Not Win32 But Win64 )
End;

Var
  MyObj  : SecObj;
  MyClass: BaseClass;

Begin
  MyObj.Create;
  MyObj.P1; // <----- Not Raise Exception This Line ( Win32 & Win64 )
  // ----------------------------------------

  MyClass := BaseClass.Create;
  MyClass.MyObj.Create;
  MyClass.MyObj.P1; // <----- Raise Exception This Line ( Not Win32 But Win64 )
  MyClass.Free;

End.
Steps to Reproduce:
A)When i add "virtual" keyword in method definition:

1) In Win64 mode and define variable in global scope i can call P1 but raise exception in assign 12.0 to "v" variable;

2) In Win64 mode If i define variable inside class scope i cant call P1 and raise exception.

B) When i remove "virtual" keyword in method definition:

1) In Win64 mode and define variable in global scope or inside class escope i can call P1 but raise exception in assign 12.0 to "v" variable;


All this definition safe work in WIN32 mode.
Workarounds
None
Attachment
None
Comments

Tomohiro Takahashi at 9/27/2011 4:33:58 PM -
Do you use Delphi XE2(Build No 16.0.4256.43595)?
So, I corrected [Project], [Version] fields of this report etc... as Sysop.

Babak Yaghoobi at 9/27/2011 10:20:30 PM -
I use Embarcadero® Delphi® XE2 Version 16.0.4256.43595.

Tomohiro Takahashi at 9/27/2011 4:43:16 PM -
>   BaseObj = Object
>   ...
>   SecObj = Object( BaseObj )
Does your issue occur only when using old style, 'Object' type?

> .. but raise exception ...
Is the exception EAccessViolation?

Babak Yaghoobi at 9/27/2011 10:33:20 PM -
Access Violation Error.

Project ObjectTest.exe raised exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.

Babak Yaghoobi at 9/27/2011 10:28:40 PM -
Yes occured only on Object style definition.

If i change Object To Class this error not occured.

Regards

shannon matthews at 12/19/2011 2:59:27 PM -
This bug has been fixed according to the Update 3 release notes.
http://edn.embarcadero.com/article/41831/

Tomohiro Takahashi at 12/19/2011 5:50:20 PM -
Yes, this issue should be fixed in Update 3.
So, this report will be closed as 'Fixed' in the near future.

Server Response from: ETNACODE01