develooper Front page | perl.perl5.porters | Postings from June 2003

Re: your malloc patches

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
June 15, 2003 02:54
Subject:
Re: your malloc patches
Message ID:
20030615095347.GD469614@kosh.hut.fi
Thanks, looking much better, but I'm afraid a bit more work is needed.
Too many GCCisms, a strange include file, and an assertion failure.

(1) The ,) macro was still there: in perl.h:

#define MALLOC_CHECK_TAINT2(argc,argv)  MALLOC_CHECK_TAINT(argc,argv,)

This just isn't cricket for non-GCC compilers (Solaris, AIX, and Tru64
claim a syntax error, IRIX seems to tolerate it).  That a function
call (Perl_doing_taint in this case) gets expanded to func(a,b,) just
isn't going to work.  (What does leaving out an argument like that
_mean_, anyway?  An implicit 0?)

Trying to get this to compile I kludged over this nit by using

#define MALLOC_CHECK_TAINT2(argc,argv)  MALLOC_CHECK_TAINT(argc,argv,0)

since the envp doesn't seem to be used for anything right now.
After this I run into the following:

(2) Solaris Workshop cc doesn't like the malloc code:

"malloc.c", line 1209: a cast does not yield an lvalue
"malloc.c", line 1221: a cast does not yield an lvalue
"malloc.c", line 1241: a cast does not yield an lvalue
"malloc.c", line 1520: cannot recover from previous errors
cc: acomp failed for malloc.c

AIX cc is similarly cranky:

"malloc.c", line 1208.9: 1506-025 (S) Operand must be a modifiable lvalue.
"malloc.c", line 1220.13: 1506-025 (S) Operand must be a modifiable lvalue.
"malloc.c", line 1240.9: 1506-025 (S) Operand must be a modifiable lvalue.
make: The error code from the last command is 1.

(3) What is the io.h used in malloc.?

...
#    include <memory.h>
#    include <io.h>
#    include <string.h>
...

AIX compilation falls on that (the above AIX result about modifiable
lvalues I got by removing that include and rerunning "make depend").

(4) Tru64 compiles but then miniperl fails an assertion (a 64-bit problem?):

        && LD_LIBRARY_PATH=/cluster/members/member0/tmp/jhi/perl:/tmp/jhi/perl:/p/lib ./perl TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t </dev/tty
assertion botched (free()ed/realloc()ed-away memory was overwritten?): !(MallocCfg[MallocCfg_filldead] && MallocCfg[MallocCfg_fillcheck]) || !cmp_pat_4bytes((unsigned char*)((caddr_t)ovp + nbytes - sizeof (unsigned int) + sizeof(unsigned int)), ((1 << (((ovp)->ovu.ovu_index) >> 0)) - (sizeof(union overhead) + sizeof (unsigned int)) + (((ovp)->ovu.ovu_index >= 15 * 1) ? 4096 : 0)) - (nbytes - sizeof (unsigned int) + sizeof(unsigned int)), fill_deadbeef)
Core: cannot create core file -- system version limit (1) reached.
/bin/sh: 452868 Abort
make[1]: [minitest] Error 134 (ignored)
make[1]: Leaving directory `/cluster/members/member0/tmp/jhi/perl'
LD_LIBRARY_PATH=/cluster/members/member0/tmp/jhi/perl:/tmp/jhi/perl:/p/lib ./miniperl -Ilib configpm configpm.tmp
assertion botched (free()ed/realloc()ed-away memory was overwritten?): !(MallocCfg[MallocCfg_filldead] && MallocCfg[MallocCfg_fillcheck]) || !cmp_pat_4bytes((unsigned char*)((caddr_t)ovp + nbytes - sizeof (unsigned int) + sizeof(unsigned int)), ((1 << (((ovp)->ovu.ovu_index) >> 0)) - (sizeof(union overhead) + sizeof (unsigned int)) + (((ovp)->ovu.ovu_index >= 15 * 1) ? 4096 : 0)) - (nbytes - sizeof (unsigned int) + sizeof(unsigned int)), fill_deadbeef)

The stack trace:

>  0 __kill(0x3ff800ddee8, 0x0, 0x3ff801c9898, 0x14002ae20, 0x1c) [0x3ff800e9468]
   1 (unknown)() [0x3ff802132a0]
   2 __tis_raise(0x1c, 0xffffffffffffffff, 0x3ff8013c1f8, 0x14002ae20, 0x3ff801c98cc) [0x3ff8013c1f4]
   3 abort(0x3ffbfeab6a4, 0x140035308, 0x0, 0x0, 0x3ff00000000) [0x3ff801c98c8]
   4 botch(diag = 0x3fffffc2058 = "free()ed/realloc()ed-away memory was overwritten", s = 0x3fffffc2570 = "!(MallocCfg[MallocCfg_filldead] && MallocCfg[MallocCfg_fillcheck]) || !cmp_pat_4bytes((unsigned char*)((caddr_t)ovp + nbytes - sizeof (u\...") ["malloc.c":1281, 0x3ffbfeab6a0]
   5 Perl_mfree(mp = 0x14002ae28) ["malloc.c":2035, 0x3ffbfeacd24]
   6 Perl_sv_clear(sv = 0x14002be98) ["sv.c":5450, 0x3ffbff49640]
   7 Perl_sv_free2(sv = 0x14002be98) ["sv.c":5597, 0x3ffbff49ae4]
   8 Perl_sv_free(sv = 0x14002be98) ["sv.c":5577, 0x3ffbff499c0]
   9 Perl_ck_rvconst(o = 0x140034b08) ["opmini.c":4978, 0x120018470]
  10 Perl_newUNOP(type = 15, flags = 0, first = 0x14002d348) ["opmini.c":2211, 0x12000d110]
  11 Perl_newSVREF(o = 0x14002d348) ["opmini.c":4656, 0x120017370]
  12 Perl_yyparse() ["perly.c":764, 0x3ffbfedcbe0]
  13 S_doeval(gimme = 0, startop = (nil), outside = (nil), seq = 0) ["pp_ctl.c":2855, 0x3ffbff7f570]
  14 Perl_pp_require() ["pp_ctl.c":3332, 0x3ffbff81b84]
  15 Perl_runops_debug() ["dump.c":1430, 0x3ffbff11dd4]
  16 S_call_body(myop = 0x11fffb480, is_eval = 0) ["perl.c":1949, 0x3ffbfea4e50]
  17 Perl_call_sv(sv = 0x140027318, flags = 6) ["perl.c":1867, 0x3ffbfea4ad8]
  18 S_call_list_body(cv = 0x140027318) ["perl.c":4114, 0x3ffbfeaaae4]
  19 Perl_call_list(oldscope = 1, paramList = 0x1400273c8) ["perl.c":4043, 0x3ffbfeaa6cc]
  20 Perl_newATTRSUB(floor = 103, o = 0x14002d088, proto = (nil), attrs = (nil), block = 0x14002d808) ["opmini.c":4278, 0x1200155b8]
  21 Perl_utilize(aver = 1, floor = 103, version = (nil), idop = 0x14001a388, arg = (nil)) ["opmini.c":2901, 0x120010034]
  22 Perl_yyparse() ["perly.c":412, 0x3ffbfedb020]
  23 S_parse_body(env = (nil), xsinit = 0x120006adc) ["perl.c":1429, 0x3ffbfea31e4]
  24 perl_parse(my_perl = 0x1400061a0, xsinit = 0x120006adc, argc = 6, argv = 0x11fffc018, env = (nil)) ["perl.c":936, 0x3ffbfea1d58]
  25 main(argc = 6, argv = 0x11fffc018, env = 0x11fffc050) ["miniperlmain.c":84, 0x120006a50]

-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

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