develooper Front page | perl.perl5.porters | Postings from May 2010

Re: 5.12: inplace sort <*> segfault (gcc 4.5.0 bug?)

Thread Previous | Thread Next
From:
hv
Date:
May 11, 2010 12:25
Subject:
Re: 5.12: inplace sort <*> segfault (gcc 4.5.0 bug?)
Message ID:
201005111902.o4BJ2gks024845@zen.crypt.org
Alex Hunsaker <badalex@gmail.com> wrote:
:On Tue, May 11, 2010 at 09:57, Nicholas Clark <nick@ccl4.org> wrote:
:> On Tue, May 11, 2010 at 11:53:14AM -0400, Eric Brine wrote:
:>> On Tue, May 11, 2010 at 11:38 AM, Nicholas Clark <nick@ccl4.org> wrote:
:>>
:>> > > I suspect that the reader/rejector assumed that the indexes for notnull()
:>> > > start at 0. They start at 1. If you make that mistake, you would conclude
:>> > > (wrongly) what the rejector did.
:>> >
:>> > Gah. I think I'm wrong here. I'm not convinced that the test case is
:>> > correct.
:>> >
:>>
:>> What you say matches the docs:
:>>
:>> extern void *
:>>  my_memcpy (void *dest, const void *src, size_t len)
:>> __attribute__((nonnull (1, 2)));
:>>
:>> causes the compiler to check that, in calls to my_memcpy, arguments dest and
:>> src are non-null.
:>>
:>> so nonnull(2) would apply to o, the 2nd arg.
:>
:> But the bug (in op.c) was when the final (3rd) argument oright was annotated
:> as non-null, but gcc was treating the 2nd argument, o, as non-null.
:
:I think you mean the reverse: o is marked nonnull (and is not null),
:oright is not annotated and is NULL.  Either way it same gcc bug. =)
:
:STATIC OP*      S_is_inplace_av(pTHX_ OP* o, OP* oright)
:                       __attribute__nonnull__(pTHX_1);

Yes, I agree Nick said it the wrong way round. This expanded in the build
I did to:
  static OP* S_is_inplace_av(PerlInterpreter* my_perl __attribute__((unused)), OP* o, OP* oright)
   __attribute__((nonnull(2)));
.. in which nonnull(2) refers to the parameter 'o'.

The signature in my gcc testcase is essentially the same; only the first
parameter is simplified:
  static OP* test(void* v, OP* o, OP *o2)
        __attribute__((nonnull(2)));

Hugo

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