<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">In Standard 5.2 I see these two phrases:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(p 48, 16-19) A throw executed inside a region that arises from a thread-limiting directive must cause 17 execution to resume within the same region, and the same thread that threw the exception must 18 catch it. If the directive is also
 exception-aborting then whether the exception is caught or the 19 throw results in runtime error termination is implementation defined.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(p 617, 3-4) Whether a throw executed inside a region that arises from an exception-aborting directive 4 results in runtime error termination is implementation defined (see Section 3.1).
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am trying the attached test, <o:p></o:p></p>
<p class="MsoNormal">clang -O0 task_ftp_EH3_noeh.cpp  -DNOISY -DCOUNT=2 -fopenmp<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The essential part:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">void main_test(MyObject* pTree, int i) {<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">    if (!pTree) return;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#pragma omp parallel default(none) shared(i, pTree) num_threads(NUM_THREADS)
<o:p></o:p></p>
<p class="MsoNormal">#pragma omp single<o:p></o:p></p>
<p class="MsoNormal">    {<o:p></o:p></p>
<p class="MsoNormal">        while (pTree) {<o:p></o:p></p>
<p class="MsoNormal">            try {<o:p></o:p></p>
<p class="MsoNormal">                MyObject tree(*pTree);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">#pragma omp task firstprivate(i, tree)<o:p></o:p></p>
<p class="MsoNormal">                {<o:p></o:p></p>
<p class="MsoNormal">                    …<o:p></o:p></p>
<p class="MsoNormal">                    main_test(tree.right, i + 4);<o:p></o:p></p>
<p class="MsoNormal">                }<o:p></o:p></p>
<p class="MsoNormal">                  …<o:p></o:p></p>
<p class="MsoNormal">            }<o:p></o:p></p>
<p class="MsoNormal">            catch (std::exception) {<o:p></o:p></p>
<p class="MsoNormal">                …<o:p></o:p></p>
<p class="MsoNormal">            }<o:p></o:p></p>
<p class="MsoNormal">            …<o:p></o:p></p>
<p class="MsoNormal">        }<o:p></o:p></p>
<p class="MsoNormal">    }<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">Where copy constructor for ‘tree’ throws when it’s called for firstprivate clause (called second time).<o:p></o:p></p>
<p class="MsoNormal">My assumption was that the clause is computed in the ‘single’ region, not ‘task’ region, and catch is there too, so I thought that technically it should be legal and catch should work.<o:p></o:p></p>
<p class="MsoNormal">This is hanging in the runtime, verified with llvm 13 release.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it a bug?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank you,<o:p></o:p></p>
<p class="MsoNormal">Natalia Glagoleva<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>