txr-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Txr-users] txr segfaults on startup, Mac OSX 10.6


From: Kaz Kylheku
Subject: Re: [Txr-users] txr segfaults on startup, Mac OSX 10.6
Date: Mon, 05 Dec 2011 23:45:30 -0800
User-agent: Roundcube Webmail/0.4

On Mon, 05 Dec 2011 22:46:07 -0800, Kaz Kylheku <address@hidden>
wrote:
> Hi Andy,
> 
> Thanks for diagnosing this.

This is an octal/decimal mixup, almost certainly.

In configure I have:

intptr_max_expr="((((($intptr) 1 << $((sizeof_ptr * 8 - 2))) - 1) << 1)
+ 1)"
printf "#define INT_PTR_MAX %s\n" "$intptr_max_expr" >> config.h

So "sizeof_ptr" must be 10 to produce 78. 10 is octal for 8.

In fact I'm expecting the "nm" tool to put out octal which is
why I have this:

  while read symbol type offset size ; do
    eval "size=$(( 0$size + 0 ))"

But I neglected this trick in the next few lines:

    if [ "$type" = "C" ] ; then
      size=$offset
    fi

these were needed on Cygwin. This $offset is also
but on Cygwin it's just 4. Maybe we are hitting
this case on OS X, and getting "10".

Just for fun, try replacing this size=$offset
with:
 
  size=$(( 0$offset + 0 ))

here instead. (I don't think the eval is needed.)

Now why on earth did I pass "-t o" to nm in the Makefile?
I wouldn't use octal without a good reason.

...

AH!!! I remember. The reason is that nm puts out figures
with leading zeros. These are interpreted as octal in
shell arithmetic, whether you like it or not.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]