- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiling the following on windows with icl or icx with /EHs causes the destructor for the test object to be called twice.
#include <iostream>
#include <csetjmp>
jmp_buf buffer1;
jmp_buf buffer2;
class Test
{
public:
~Test()
{
std::cout << "Test destructor: " << this << std::endl;
}
};
void p2()
{
longjmp( buffer2, 1 );
}
void p1()
{
{
Test test;
if ( setjmp( buffer2 ) == 0 )
{
p2();
}
}
std::cout << "Jumping" << std::endl;
longjmp( buffer1, 1 );
}
int main()
{
if ( setjmp( buffer1 ) == 0 )
{
p1();
}
return 0;
}
This produces the following output:
C:\tmp>icx /EHs intelbug.cpp
Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2022.1.0 Build 20220316
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
C:\tmp>intelbug
Test destructor: 000000595F6FFDA0
Jumping
Test destructor: 000000595F6FFDA0
I know that mixing longjmps with c++ and destructors in particular can be problematic, but I don't think the longjmps should be causing a problem in this case.
This does not happen with VS 2019.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dohashi,
Thanks for posting on Intel Communities and reporting this issue. We were able to reproduce it on our end and we have informed the development team about it.
We will get back to you soon with an update.
Best Regards,
Shanmukh.SS

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page