9front - general discussion about 9front
 help / color / mirror / Atom feed
From: tlaronde@polynum.com
To: ori@eigenstate.org
Cc: 9front@9front.org
Subject: Re: [9front] putc/fputc incorrect return?
Date: Thu, 9 Jul 2020 18:17:07 +0200	[thread overview]
Message-ID: <20200709161707.GA45@polynum.com> (raw)
In-Reply-To: <6DEA5358DBED01899CCC4A11FFAD93A4@eigenstate.org>

Hello,

On Thu, Jul 09, 2020 at 07:27:13AM -0700, ori@eigenstate.org wrote:
> 
> > I write, say 0xaa, it returns 0xffffffaa. So when comparing, this
> > failed.
> > 
> > But the problem is that if I write 0xff it returns 0xffffffff that is
> > EOF...
> > 
> > Isn't putc/fputc supposed to return a "char" as a value that is
> > 0x000000nn so precisely one can differenciate from EOF error?
> 
> Hey -- thanks for the report, but I can't reproduce your issue.
> Here's my test code:
> 
> #include <stdio.h>
> 
> int
> main(int argc, char **argv)
> {
> 	printf("\n'%x'\n", putc(0xaa, stdout));
> 	return 0;
> }
> 
> It prints
> <junk>
> 'aa'
> 
> I'm running on 9front tip, on amd64.

Yep, if I compile just this, I get the same and the correct result.

But if I print the returned value in the kerTeX code, I get the
promotion ("0xffffffaa") (whether calling putc or fputc)...

I will have to try to reduce the code to the strict minimum to
understand what the hell is going on (it works everywhere and it used to
work under 9front too).

But there is a fair amount of cascading cpp substitutions due to the
pseudo-pascal to raw C dance plus system patching and it triggers something...

And (last minute memory), it tries to use registers too (I will need to
test this too to see if that makes a difference).

Best,
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


  reply	other threads:[~2020-07-09 16:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  8:21 tlaronde
2020-07-09 14:27 ` [9front] " ori
2020-07-09 16:17   ` tlaronde [this message]
2020-07-09 16:55     ` ori
2020-07-09 18:29       ` tlaronde
2020-07-09 18:39         ` ori
2020-07-11 14:39           ` [FOUND] [9front] putc/fputc incorrect return tlaronde
2020-07-11 15:45             ` ori
2020-07-11 16:43               ` tlaronde
2020-07-13 10:36               ` tlaronde

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=20200709161707.GA45@polynum.com \
    --to=tlaronde@polynum.com \
    --cc=9front@9front.org \
    --cc=ori@eigenstate.org \
    /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 NNTP newsgroup(s).