Message ID | CACysShjvgA_OmY0j_MAZ-RMjHjHxs9Gv2JW1XErK6VuCpB0dbw@mail.gmail.com |
---|---|
State | New |
Headers | show |
Hi Alexander, On Thu, Apr 18, 2013 at 12:49 PM, Alexander Ivchenko <aivchenk@gmail.com> wrote: > I'm trying it on linux/x86_64 on trunk. Testing just by adding -fpic > to the dg-options: > > --- a/gcc/testsuite/g++.dg/tm/pr47746.C > +++ b/gcc/testsuite/g++.dg/tm/pr47746.C > @@ -1,5 +1,5 @@ > // { dg-do compile } > -// { dg-options "-fgnu-tm" } > +// { dg-options "-fgnu-tm -fpic" } > > Here is the error msg: > > testsuite/g++.dg/tm/pr47746.C:20:14: error: unsafe function call 'void > Building::load(InputStream*)' within 'transaction_safe' function Thanks! Now I understand the error (and I am able to reproduce it). :) > 4462| know what it will contain at runtime. */ > 4463| if (cgraph_function_body_availability (node) < AVAIL_AVAILABLE) > 4464+> return true; > 4465| > > (gdb) p cgraph_function_body_availability (node) > $54 = AVAIL_OVERWRITABLE > > Sure I can file a PR If you think that the test was not supposed to > fail with -fpic I think your patch is OK but I cannot approve it since I am not a maintainer. I CCed Richard since he is the one who can approve and knows the TM implementation. Thanks, -- Patrick
*ping* Alexander 2013/4/18 Patrick Marlier <patrick.marlier@gmail.com>: > Hi Alexander, > > On Thu, Apr 18, 2013 at 12:49 PM, Alexander Ivchenko <aivchenk@gmail.com> wrote: >> I'm trying it on linux/x86_64 on trunk. Testing just by adding -fpic >> to the dg-options: >> >> --- a/gcc/testsuite/g++.dg/tm/pr47746.C >> +++ b/gcc/testsuite/g++.dg/tm/pr47746.C >> @@ -1,5 +1,5 @@ >> // { dg-do compile } >> -// { dg-options "-fgnu-tm" } >> +// { dg-options "-fgnu-tm -fpic" } >> >> Here is the error msg: >> >> testsuite/g++.dg/tm/pr47746.C:20:14: error: unsafe function call 'void >> Building::load(InputStream*)' within 'transaction_safe' function > > Thanks! Now I understand the error (and I am able to reproduce it). :) > >> 4462| know what it will contain at runtime. */ >> 4463| if (cgraph_function_body_availability (node) < AVAIL_AVAILABLE) >> 4464+> return true; >> 4465| >> >> (gdb) p cgraph_function_body_availability (node) >> $54 = AVAIL_OVERWRITABLE >> >> Sure I can file a PR If you think that the test was not supposed to >> fail with -fpic > > I think your patch is OK but I cannot approve it since I am not a maintainer. > I CCed Richard since he is the one who can approve and knows the TM > implementation. > > Thanks, > -- > Patrick
Oh, sorry. Missed the last msg from Mike in that thread. 2013/5/27 Alexander Ivchenko <aivchenk@gmail.com>: > *ping* > > Alexander > > 2013/4/18 Patrick Marlier <patrick.marlier@gmail.com>: >> Hi Alexander, >> >> On Thu, Apr 18, 2013 at 12:49 PM, Alexander Ivchenko <aivchenk@gmail.com> wrote: >>> I'm trying it on linux/x86_64 on trunk. Testing just by adding -fpic >>> to the dg-options: >>> >>> --- a/gcc/testsuite/g++.dg/tm/pr47746.C >>> +++ b/gcc/testsuite/g++.dg/tm/pr47746.C >>> @@ -1,5 +1,5 @@ >>> // { dg-do compile } >>> -// { dg-options "-fgnu-tm" } >>> +// { dg-options "-fgnu-tm -fpic" } >>> >>> Here is the error msg: >>> >>> testsuite/g++.dg/tm/pr47746.C:20:14: error: unsafe function call 'void >>> Building::load(InputStream*)' within 'transaction_safe' function >> >> Thanks! Now I understand the error (and I am able to reproduce it). :) >> >>> 4462| know what it will contain at runtime. */ >>> 4463| if (cgraph_function_body_availability (node) < AVAIL_AVAILABLE) >>> 4464+> return true; >>> 4465| >>> >>> (gdb) p cgraph_function_body_availability (node) >>> $54 = AVAIL_OVERWRITABLE >>> >>> Sure I can file a PR If you think that the test was not supposed to >>> fail with -fpic >> >> I think your patch is OK but I cannot approve it since I am not a maintainer. >> I CCed Richard since he is the one who can approve and knows the TM >> implementation. >> >> Thanks, >> -- >> Patrick
Hi, This is just a memo about why the testcase failed: When it tries to compile, we get this: gcc/testsuite/g++.dg/tm/pr47746.C:20:14: error: unsafe function call ‘void Building::load(InputStream*)’ within ‘transaction_safe’ function load(stream); Indeed, with PIC, the 'load' method can be overloaded later so we cannot infer that the body will be transaction_safe. in trans-mem.c: 4461| /* If we aren't seeing the final version of the function we don't 4462| know what it will contain at runtime. */ 4463| if (cgraph_function_body_availability (node) < AVAIL_AVAILABLE) 4464+> return true; The two ways to fix this, is either to force for non-pic target or to add transaction_safe attribute to 'load' and 'readUint32' methods. -- Patrick
--- a/gcc/testsuite/g++.dg/tm/pr47746.C +++ b/gcc/testsuite/g++.dg/tm/pr47746.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-fgnu-tm" } +// { dg-options "-fgnu-tm -fpic" } Here is the error msg: