public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Mike Mason <mmlnx@us.ibm.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: systemtap@sources.redhat.com
Subject: Re: Problem with 32-bit negative return values
Date: Tue, 10 Oct 2006 20:41:00 -0000	[thread overview]
Message-ID: <452C0550.4090404@us.ibm.com> (raw)
In-Reply-To: <20061010175159.GH14473@redhat.com>

Frank Ch. Eigler wrote:
> Hi -
> 
> On Tue, Oct 10, 2006 at 10:34:07AM -0700, Mike Mason wrote:
>> [...]
>> I'm trying to use the return value from sock_recvmsg() to determine how 
>> many bytes are received.  It ignores negative return values (errors).
>> [...]
>> But on x86_64, the negative values are interpreted and printed as large 
>> positive values:
>> RECV 1440
>> RECV 4294967285
>> [...]
> 
> It could easily be a typing/sign-extension bug in the loc2c-related
> code.  Could you check the generated C code (-p3; look for the
> _dwarf_tvar_get function)?

Here's the suspect code generated with -p3:

      l->__tmp18 =
      ({

        if (unlikely (c->nesting+2 >= MAXNESTING)) {
          c->last_error = "MAXNESTING exceeded";
          c->last_stmt = "identifier '$return' at nettop3.stp:56:15";
        } else if (likely (! c->last_error)) {
          c->nesting ++;
          function__dwarf_tvar_get_return_8 (c);
          c->nesting --;
          if (c->last_error && ! c->last_error[0])
            c->last_error = 0;
        }
        c->locals[c->nesting+1].function__dwarf_tvar_get_return_8.__retvalue;
      });
      if (likely (! c->last_error)) {
        l->__tmp19 = 0;
        _stp_printf ("RECV %lld\n", l->__tmp18);
      }


> 
> - FChE

  parent reply	other threads:[~2006-10-10 20:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <452BD98F.8050602@us.ibm.com>
2006-10-10 17:52 ` Frank Ch. Eigler
2006-10-10 18:28   ` Roland McGrath
2006-10-10 20:25     ` Frank Ch. Eigler
2006-10-10 20:41   ` Mike Mason [this message]
2006-10-07 21:23 Mike Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=452C0550.4090404@us.ibm.com \
    --to=mmlnx@us.ibm.com \
    --cc=fche@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).