New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double macro argument evaluation in S_init_main_stash #16292
Comments
From pipcet@gmail.comCreated by pipcet@gmail.comI just came across the following problem: S_init_main_stash contains the code: PL_curstash = PL_defstash = (HV *)SvREFCNT_inc_simple_NN(newHV()); SvREFCNT_inc_simple_NN is defined as: #define SvREFCNT_inc_simple_NN(sv) (++(SvREFCNT(sv)),MUTABLE_SV(sv)) That evaluates its argument twice, which breaks with side effects. So newHV() is called twice, one of the new HVs gets refcount 2 and Sorry if this message gets duplicated, I tried sending it a few days ago Perl Info
|
The RT System itself - Status changed from 'new' to 'open' |
@arc - Status changed from 'open' to 'resolved' |
From @cpansproutOn Fri, 08 Dec 2017 02:28:38 -0800, arc wrote:
Thank you for the quick fix. I was guilty of making that mistake, in this commit: commit 03d9f02 [perl #101486] Make PL_curstash refcounted This was when I added refcounting to PL_curstash to begin with. So I wonder whether it is possible to test the fix. -- Father Chrysostomos |
From @hvdsOn Fri, 08 Dec 2017 02:28:38 -0800, arc wrote:
Is there also some portable way to fix the double-evaluation of the macro, or can we use some naming convention to call out the macros that will do multiple evaluation? Are we at the point where our target set of compilers can all handle inline functions, for example? Hugo |
From pipcet@gmail.comOn Fri, Dec 8, 2017 at 2:36 PM, Father Chrysostomos via RT
I don't think it is. The code a few lines down from where the bug was |
From zefram@fysh.orgHugo van der Sanden via RT wrote:
We do the latter, to some extent. The SvREFCNT_inc() macros with
They can all handle static functions, which is close enough. -zefram |
Migrated from rt.perl.org#132545 (status was 'resolved')
Searchable as RT132545$
The text was updated successfully, but these errors were encountered: