develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #120314] t/re/fold_grind.t spews tons of "Attempt to free temp prematurely" warnings on DEBUGGING but ultimately passes

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
October 30, 2013 20:27
Subject:
[perl #120314] t/re/fold_grind.t spews tons of "Attempt to free temp prematurely" warnings on DEBUGGING but ultimately passes
Message ID:
rt-4.0.18-27395-1383164850-87.120314-15-0@perl.org
On Wed Oct 30 07:39:36 2013, craig.a.berry@gmail.com wrote:
> On Wed, Oct 30, 2013 at 7:41 AM, Father Chrysostomos via RT
> <perlbug-followup@perl.org> wrote:
> 
> > When you sent your last message, I had already written the attached
> > patch.  What do you think of this approach?
> 
> I like it; it's a clear, surgical exception to what the compiler would
> do on its own.
> 
> > +On some platforms, C<bool> is defined as equivalent to C<char>.
> 
> s/some/pre-C99/
> 
> > +Consequently assignment of any larger type to a C<bool> is unsafe
> > and may
> > +be truncated.  The C<cBOOL> macro exists to cast it correctly.
> > +
> > +On those platforms and compilers where C<bool> really is a boolean
> > (C++,
> > +F<stdbool.h>), it is easy to forget the cast.  You can force C<bool>
> > to be
> > +a C<char> by compiling with C<-Accflags=-DPERL_BOOL_AS_CHAR>.
> 
> You may also wish to add C<-Werror=conversion> or local equivalent to
> make it impossible to ignore the unsafe truncations.

Revised patch attached.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: resolved
https://rt.perl.org/Ticket/Display.html?id=120314

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About