Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 9 - Last Post: Feb 19, 2016 8:46 AM Last Post By: Remy Lebeau (Te...
John Borchers

Posts: 42
Registered: 9/23/10
Updated to XE10 Seattle Update 1, now exception on rethrows with Clang  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 18, 2016 9:41 AM
Hi all,

I am using a remote connection through PAServer (which also had been updated by going to update 1 pack). This code was working before compiled with Clang the same way. But now it faults. I originally had this with __finally clauses which Remy had shown me but that also seems to have a problem so I backed those out to go back to the basics.

I have the following code:
try {
//just sends out the TCP port and tries to retrieve into a stream
}
catch (EIdReadTimeout &E) {
// check for response error
if (inputStream->Size == 5) {
// we have an error response
ResponseErr_Struct* ErrResponse =
(ResponseErr_Struct*) inputStream->Memory;
}
else {
delete outputStream;
delete inputStream;
//throw ECommunicationException
throw Exception //debugger has this line highlighted as the fault point
("Communication Read Error - No response");
}
}

On rethrow with of different type I tried both my own ECommunicationException, then thinking something was wrong with my derived class I tried just the Exception class. I keep getting an access violation exception 0xC0000005 on the creation of the Exception object with the following stack dump:

:00619c14 ; PAdirectory\CC32C230MT.DLL <- this is the access violation point
:00619b70 ; PAdirectory\CC32C230MT.DLL
:0061a77d ; PAdirectory\CC32C230MT.DLL
:0061a99d ; PAdirectory\CC32C230MT.DLL
:0061acf5 ;PAdirectory\CC32C230MT.DLL
:77376ab9 ; ntdll.dll
:77376a8b ; ntdll.dll
:50060a3c rtl230.@System@@HandleAnyException$qqrv + 0xd8
:77376a8b ; ntdll.dll
:77340143 ntdll.KiUserExceptionDispatcher + 0xf
:00619ca4 CC32C230MT.___throw_as_delphi + 0x58
:00619823 CC32C230MT.___cxa_throw + 0x2b
:00425A63 ReadCommand(this=:01F71CC0, Address=9508) <- this is my Read TCP/IP function

TIA,
John

Edited by: John Borchers on Feb 18, 2016 9:43 AM
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 18, 2016 10:58 PM   in response to: John Borchers in response to: John Borchers
On Thu, 18 Feb 2016 09:44:17 -0800, John Borchers <> wrote:

On rethrow with of different type I tried both my own ECommunicationException, then thinking something was wrong with my derived class I tried just the Exception class. I keep getting an access violation exception 0xC0000005 on the creation of the Exception object with the following stack dump:

doesn't even contrived sample work?

try
{
int * p=nullptr;
*p=0;
}
catch(Exception const &e)
{
throw Exception("rethrow another");
}

--
Vladimir Ulchenko aka vavan
John Borchers

Posts: 42
Registered: 9/23/10
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 5:59 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir I changed it a bit, but yes, total failure.

Create VCL application with a form. Place a single button on the form called Button 1 and create the following OnClick event handler. This only happens with CLANG the old Borland Compiler rethrow another gets caught by the Application Exception handler. The problem is I can't use the old compiler because I'm using vectors std:vector and access to it's data member already in the coding. I guess I'm going to have to revert back to before update 1.

//
void __fastcall TForm1::Button1Click(TObject *Sender) {
try {
throw Exception("Test");
}
catch (Exception &E) {
throw Exception("rethrow another");<- fails here access violation 0xC0000005
}
}

:32209c14 ; C:\Program Files (x86)\Embarcadero\Studio\17.0\bin\CC32C230MT.DLL
:32209b70 ; C:\Program Files (x86)\Embarcadero\Studio\17.0\bin\CC32C230MT.DLL
:3220a77d ; C:\Program Files (x86)\Embarcadero\Studio\17.0\bin\CC32C230MT.DLL
:3220a99d ; C:\Program Files (x86)\Embarcadero\Studio\17.0\bin\CC32C230MT.DLL
:3220acf5 ; C:\Program Files (x86)\Embarcadero\Studio\17.0\bin\CC32C230MT.DLL
:77c7b499 ; ntdll.dll
:77c7b46b ; ntdll.dll
:50060a3c rtl230.@System@@HandleAnyException$qqrv + 0xd8
:77c7b46b ; ntdll.dll
:77c30133 ntdll.KiUserExceptionDispatcher + 0xf
:32209ca4 CC32C230MT.___throw_as_delphi + 0x58
:32209823 CC32C230MT.___cxa_throw + 0x2b
:004035F0 Button1Click(this=:021CF0A0, Sender=:021ADBE0)

John

Edited by: John Borchers on Feb 19, 2016 6:05 AM
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 6:21 AM   in response to: John Borchers in response to: John Borchers
On Fri, 19 Feb 2016 06:06:50 -0800, John Borchers <> wrote:

This only happens with CLANG the old Borland Compiler rethrow another gets caught by the Application Exception handler

so it seems EH in CLANG isn't much better than in classic compiler
and that works for me in classic bcb2007

The problem is I can't use the old compiler because I'm using vectors std:vector and access to it's data member already in the coding

not sure what you mean here. std::vector is available in bcb for ages

--
Vladimir Ulchenko aka vavan
John Borchers

Posts: 42
Registered: 9/23/10
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 6:39 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
not sure what you mean here. std::vector is available in bcb for ages

--
Vladimir Ulchenko aka vavan

Vladimir,

It causes the following problem during compile if I do this (right now I'm uninstalling update 1). I also entered a QA report on the finding.

std::vector<double> Test;
Test.push(1);
void * data=Test.data();

Compiler says data member does not exist in the Borland standard compiler but this works in CLANG.

John

Edited by: John Borchers on Feb 19, 2016 6:39 AM
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit] [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 7:18 AM   in response to: John Borchers in response to: John Borchers
On Fri, 19 Feb 2016 06:40:08 -0800, John Borchers <> wrote:

It causes the following problem during compile if I do this (right now I'm uninstalling update 1). I also entered a QA report on the finding.

std::vector<double> Test;
Test.push(1);
void * data=Test.data();

Compiler says data member does not exist in the Borland standard compiler but this works in CLANG.

ah, this one has been introduced since c++11 hence might not be available in classic bcb
can't you use &front() instead of data()?

--
Vladimir Ulchenko aka vavan
John Borchers

Posts: 42
Registered: 9/23/10
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit] [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 7:42 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir Ulchenko wrote:
On Fri, 19 Feb 2016 06:40:08 -0800, John Borchers <> wrote:

It causes the following problem during compile if I do this (right now I'm uninstalling update 1). I also entered a QA report on the finding.

std::vector<double> Test;
Test.push(1);
void * data=Test.data();

Compiler says data member does not exist in the Borland standard compiler but this works in CLANG.

ah, this one has been introduced since c++11 hence might not be available in classic bcb
can't you use &front() instead of data()?

--
Vladimir Ulchenko aka vavan

Yes, I probably can. The trouble I had was the documentation for what members actually exist in std::vector isn't shown.

John
John Borchers

Posts: 42
Registered: 9/23/10
Re: Updated to XE10 Seattle Update 1, now exception on rethrows with Clang [Edit] [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 8:19 AM   in response to: John Borchers in response to: John Borchers
All,

I just reconfirmed the following code works completely fine on XE10 with CLANG without update 1.

try {
throw Exception("Test");
}
catch (Exception &E) {
throw Exception("rethrow another");
}

With update 1 you will get an access violation on the rethrow line.

John
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Updated to XE10 Seattle Update 1, now exception on rethrows withClang [Edit] [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 8:46 AM   in response to: John Borchers in response to: John Borchers
John wrote:

The trouble I had was the documentation for what
members actually exist in std::vector isn't shown.

http://en.cppreference.com/w/cpp/container/vector

--
Remy Lebeau (TeamB)
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Updated to XE10 Seattle Update 1, now exception on rethrows withClang [Edit] [Edit] [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 19, 2016 8:45 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir wrote:

this one has been introduced since c++11 hence might not
be available in classic bcb

No, it is not.

can't you use &front() instead of data()?

Yes, and you can also use &Test[0].

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02