Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If God is perfect, why did He create discontinuous functions?


devel / comp.lang.c / Re: bart again (UCX64)

SubjectAuthor
* bart again (UCX64)Paul Edwards
+* Re: bart again (UCX64)Bart
|+* Re: bart again (UCX64)Paul Edwards
||`* Re: bart again (UCX64)Bart
|| +- Re: bart again (UCX64)Paul Edwards
|| `- Re: bart again (UCX64)Dan Cross
|+* Re: bart again (UCX64)Bart
||`* Re: bart again (UCX64)Paul Edwards
|| `* Re: bart again (UCX64)Bart
||  `- Re: bart again (UCX64)Paul Edwards
|`- Re: bart again (UCX64)Chris M. Thomasson
+- Re: bart again (UCX64)Paul Edwards
+* Re: bart again (UCX64)Anton Shepelev
|`* Re: bart again (UCX64)Paul Edwards
| `* Re: bart again (UCX64)Bart
|  `* Re: bart again (UCX64)Paul Edwards
|   +* Re: bart again (UCX64)Paul Edwards
|   |`- Re: bart again (UCX64)Paul Edwards
|   `* Re: bart again (UCX64)Bart
|    +* Re: bart again (UCX64)Paul Edwards
|    |`* Re: bart again (UCX64)Bart
|    | `* Re: bart again (UCX64)Paul Edwards
|    |  `* Re: bart again (UCX64)Bart
|    |   `* Re: bart again (UCX64)Paul Edwards
|    |    +* Re: bart again (UCX64)Bart
|    |    |`- Re: bart again (UCX64)Paul Edwards
|    |    `* Re: bart again (UCX64)Bart
|    |     +* Re: bart again (UCX64)Paul Edwards
|    |     |+* Re: bart again (UCX64)Bart
|    |     ||`* Re: bart again (UCX64)Paul Edwards
|    |     || +* Re: bart again (UCX64)Bart
|    |     || |+- Re: bart again (UCX64)Paul Edwards
|    |     || |`* Re: bart again (UCX64)Keith Thompson
|    |     || | `* Re: bart again (UCX64)Scott Lurndal
|    |     || |  `- Re: bart again (UCX64)David Brown
|    |     || `- Re: bart again (UCX64)Paul Edwards
|    |     |`* Re: bart again (UCX64)Scott Lurndal
|    |     | `- Re: bart again (UCX64)Ben Bacarisse
|    |     `* Re: bart again (UCX64)David Brown
|    |      `* Re: bart again (UCX64)Bart
|    |       +- Re: bart again (UCX64)Bart
|    |       +* Re: bart again (UCX64)David Brown
|    |       |`* Re: bart again (UCX64)Bart
|    |       | +* Re: bart again (UCX64)Keith Thompson
|    |       | |+* Verbosity in command output (Was: bart again (UCX64))Kenny McCormack
|    |       | ||`* Re: Verbosity in command output (Was: bart again (UCX64))Kaz Kylheku
|    |       | || `* Re: Verbosity in command output (Was: bart again (UCX64))Malcolm McLean
|    |       | ||  `- Re: Verbosity in command output (Was: bart again (UCX64))Kaz Kylheku
|    |       | |`* Re: bart again (UCX64)Bart
|    |       | | `- Re: bart again (UCX64)Keith Thompson
|    |       | +- Re: bart again (UCX64)Scott Lurndal
|    |       | +* Re: bart again (UCX64)Scott Lurndal
|    |       | |`* Re: bart again (UCX64)Bart
|    |       | | +- Re: bart again (UCX64)Scott Lurndal
|    |       | | +* Re: bart again (UCX64)Keith Thompson
|    |       | | |`* Re: bart again (UCX64)Bart
|    |       | | | +* Re: bart again (UCX64)Paul Edwards
|    |       | | | |+* Re: bart again (UCX64)Chris M. Thomasson
|    |       | | | ||`* Re: bart again (UCX64)Paul Edwards
|    |       | | | || `- Re: bart again (UCX64)Kaz Kylheku
|    |       | | | |`- Re: bart again (UCX64)Bart
|    |       | | | +- Re: bart again (UCX64)Kaz Kylheku
|    |       | | | `- Re: bart again (UCX64)Keith Thompson
|    |       | | `* Re: bart again (UCX64)David Brown
|    |       | |  `* Re: bart again (UCX64)Bart
|    |       | |   +- Re: bart again (UCX64)David Brown
|    |       | |   +* Re: bart again (UCX64)Richard Harnden
|    |       | |   |`* Re: bart again (UCX64)Bart
|    |       | |   | +- Re: bart again (UCX64)David Brown
|    |       | |   | +* Re: bart again (UCX64)Richard Harnden
|    |       | |   | |+- Re: bart again (UCX64)David Brown
|    |       | |   | |`* Re: bart again (UCX64)Bart
|    |       | |   | | `- Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | +* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | |`* Re: bart again (UCX64)Bart
|    |       | |   | | +* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | |`* Re: bart again (UCX64)Bart
|    |       | |   | | | +* Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | | | |`* Re: bart again (UCX64)Bart
|    |       | |   | | | | `* Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | | | |  `* Re: bart again (UCX64)Bart
|    |       | |   | | | |   +* Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | | | |   |`* Re: bart again (UCX64)Bart
|    |       | |   | | | |   | `* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |  `* Re: bart again (UCX64)Bart
|    |       | |   | | | |   |   `* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |    `* Re: bart again (UCX64)Bart
|    |       | |   | | | |   |     +* Re: bart again (UCX64)Malcolm McLean
|    |       | |   | | | |   |     |+* Re: bart again (UCX64)Bart
|    |       | |   | | | |   |     ||`* Re: bart again (UCX64)Malcolm McLean
|    |       | |   | | | |   |     || `* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |     ||  `* Re: bart again (UCX64)Bart
|    |       | |   | | | |   |     ||   `- Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |     |`- Re: bart again (UCX64)David Brown
|    |       | |   | | | |   |     +- Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |     `* Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | | | |   |      +* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |      |`* Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | | | |   |      | +* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |      | |`* Re: bart again (UCX64)Bart
|    |       | |   | | | |   |      | | +- Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | | | |   |      | | `- Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | | |   |      | `* Re: bart again (UCX64)Bart
|    |       | |   | | | |   |      `- Re: bart again (UCX64)Keith Thompson
|    |       | |   | | | |   `- Re: bart again (UCX64)David Brown
|    |       | |   | | | `* Re: bart again (UCX64)Ben Bacarisse
|    |       | |   | | `* Re: bart again (UCX64)Kaz Kylheku
|    |       | |   | `- Re: bart again (UCX64)Kaz Kylheku
|    |       | |   `* Re: bart again (UCX64)Kaz Kylheku
|    |       | `* Re: bart again (UCX64)David Brown
|    |       `* Re: bart again (UCX64)Kaz Kylheku
|    `* Re: bart again (UCX64)Paul Edwards
`* Re: bart again (UCX64)Michael S

Pages:12345678910111213141516
Re: bart again (UCX64)

<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28459&group=comp.lang.c#28459

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:170f:b0:76e:f2b8:1803 with SMTP id az15-20020a05620a170f00b0076ef2b81803mr22156qkb.6.1693424773333;
Wed, 30 Aug 2023 12:46:13 -0700 (PDT)
X-Received: by 2002:a05:6808:1b0e:b0:3a4:8115:5e7 with SMTP id
bx14-20020a0568081b0e00b003a4811505e7mr270467oib.10.1693424772988; Wed, 30
Aug 2023 12:46:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 30 Aug 2023 12:46:12 -0700 (PDT)
In-Reply-To: <ucnl64$2p8as$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=216.247.81.28; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 216.247.81.28
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
Subject: Re: bart again (UCX64)
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Wed, 30 Aug 2023 19:46:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2342
 by: Paul Edwards - Wed, 30 Aug 2023 19:46 UTC

On Wednesday, August 30, 2023 at 10:54:10 PM UTC+8, Bart wrote:

> It's not clear which C library is being linked in here. BCC is designed
> to use MSVCRT.DLL (that is reflected in headers like stdio.h).

I have my own msvcrt.dll, built using makefile.s64 or makefile.n64

> Because '__imp__iob' is not exported by msvcrt.dll; '_iob' is as a

I believe it is - that's why I can use mingw64 and it works.

> I managed to get your example working by using a function instead of a
> variable. See that version below. Note that in my stdio.h, 'stdout' is
> defined as:
>
> #define stdout ((FILE*)(__iob_func()+sizeof(FILE)))
>
> sizeof(FILE) is 48.

Thankyou! I wasn't aware that the function __iob_func()
existed. That is good enough for my purposes and is
now working in my environment too.

Thanks a lot!

BFN. Paul.

Re: bart again (UCX64)

<ucoe3l$2t4o2$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28467&group=comp.lang.c#28467

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Wed, 30 Aug 2023 22:59:18 +0100
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <ucoe3l$2t4o2$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 30 Aug 2023 21:59:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="74720a7a2460a1654c09ccd8f184bcc0";
logging-data="3052290"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1913tA27ug9nndipsdIIneMf+TukRTIE4s="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:UiaewXyQrhmk65gN5pX59Z/iS6o=
In-Reply-To: <65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
 by: Bart - Wed, 30 Aug 2023 21:59 UTC

On 30/08/2023 20:46, Paul Edwards wrote:
> On Wednesday, August 30, 2023 at 10:54:10 PM UTC+8, Bart wrote:
>
>> It's not clear which C library is being linked in here. BCC is designed
>> to use MSVCRT.DLL (that is reflected in headers like stdio.h).
>
> I have my own msvcrt.dll, built using makefile.s64 or makefile.n64
>
>> Because '__imp__iob' is not exported by msvcrt.dll; '_iob' is as a
>
> I believe it is - that's why I can use mingw64 and it works.

__imp_ appears to be an artefact of the linking system on Windows, and
may be to do with .lib and .a files.

If I look inside mingw64's libmsvcrt.a, I can see names starting with
__imp_. But inside msvcrt.dll itself, there are no __imp_ prefixes.

I was surprised you can use __imp_ in a source file, but it's possible
that some compilers, if you annotate a DLL imported name with
__declspec(dllimport), will add that prefix when it writes .obj files.

So that explains why you can just add it manually.

My compiler normally links directly to .DLL files (but cannot statically
link); there no .obj, .a, or .lib files involved, so that stuff isn't
needed.

Re: bart again (UCX64)

<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28470&group=comp.lang.c#28470

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:3b03:b0:76d:be7d:97d8 with SMTP id tl3-20020a05620a3b0300b0076dbe7d97d8mr25921qkn.3.1693436081426;
Wed, 30 Aug 2023 15:54:41 -0700 (PDT)
X-Received: by 2002:a05:6870:1a8b:b0:1c8:d3de:7870 with SMTP id
ef11-20020a0568701a8b00b001c8d3de7870mr345146oab.0.1693436081014; Wed, 30 Aug
2023 15:54:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 30 Aug 2023 15:54:40 -0700 (PDT)
In-Reply-To: <ucoe3l$2t4o2$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=216.247.81.28; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 216.247.81.28
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com> <ucoe3l$2t4o2$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
Subject: Re: bart again (UCX64)
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Wed, 30 Aug 2023 22:54:41 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1964
 by: Paul Edwards - Wed, 30 Aug 2023 22:54 UTC

Hi Bart.

Next error I have is:

cc64 -c -out:cclib/cclib.obj cclib/cclib.i
Compiling cclib/cclib.i to cclib/cclib.obj
In function ccpartype On line 1315 in file cclib/cclib.i

**** Code Gen Error: Block call after return ****

You can see the code here:

https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdcc/cclib/cclib.c

Change the first CC64 to XCC64 to activate the error.

It was built with makefile.n64 one level up.

BFN. Paul.

Re: bart again (UCX64)

<ucoils$2tstj$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28471&group=comp.lang.c#28471

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 00:17:16 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <ucoils$2tstj$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 30 Aug 2023 23:17:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3077043"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Vwfko7zprvFNmovIJUdeCd42qn1CaKgA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:B3jn4Aj0pt/sk5NIw27WDb35m7E=
In-Reply-To: <557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
 by: Bart - Wed, 30 Aug 2023 23:17 UTC

On 30/08/2023 23:54, Paul Edwards wrote:
> Hi Bart.
>
> Next error I have is:
>
> cc64 -c -out:cclib/cclib.obj cclib/cclib.i
> Compiling cclib/cclib.i to cclib/cclib.obj
> In function ccpartype On line 1315 in file cclib/cclib.i
>
> **** Code Gen Error: Block call after return ****
>
> You can see the code here:
>
> https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdcc/cclib/cclib.c
>
> Change the first CC64 to XCC64 to activate the error.
>
> It was built with makefile.n64 one level up.

This is a tricky one. It can be invoked like this:

typedef struct {int a,b,c;} S;

S F(void) {
S x;
return x;
}

void G(void) {
F();
return;
F();
return;
}

'S' is a struct type that is other than 1/2/4/8 bytes in size. If you
make a call to a function that returns such a type, like my F() call
above, even if you don't use the return value, it must be just before
the final return.

Once one 'return' has been seen, you can't make another such call. This
is just due to primitive handling of such data types.

Such functions need to be adjusted to use a common return point, for
example:

void G(void) {
F();
goto retpoint;
F();
retpoint:
return;

If a return value is involved, copy it to a common variable before jumping.

(I couldn't find function ccpartype in your link.)

Re: bart again (UCX64)

<e1998f76-e729-45a3-8b19-c54023e679f8n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28472&group=comp.lang.c#28472

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:8d0:b0:64f:3e89:5063 with SMTP id da16-20020a05621408d000b0064f3e895063mr31065qvb.7.1693438255545;
Wed, 30 Aug 2023 16:30:55 -0700 (PDT)
X-Received: by 2002:a05:6870:6111:b0:1bb:734c:eb8b with SMTP id
s17-20020a056870611100b001bb734ceb8bmr362276oae.0.1693438255327; Wed, 30 Aug
2023 16:30:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 30 Aug 2023 16:30:54 -0700 (PDT)
In-Reply-To: <ucoils$2tstj$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=216.247.81.28; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 216.247.81.28
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com> <ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com> <ucoils$2tstj$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e1998f76-e729-45a3-8b19-c54023e679f8n@googlegroups.com>
Subject: Re: bart again (UCX64)
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Wed, 30 Aug 2023 23:30:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3057
 by: Paul Edwards - Wed, 30 Aug 2023 23:30 UTC

On Thursday, August 31, 2023 at 7:17:30 AM UTC+8, Bart wrote:

> Once one 'return' has been seen, you can't make another such call. This
> is just due to primitive handling of such data types.
>
> Such functions need to be adjusted to use a common return point, for
> example:
>
> void G(void) {
> F();
> goto retpoint;
> F();
> retpoint:
> return;
>
> If a return value is involved, copy it to a common variable before jumping.

Thanks for the workaround!

> (I couldn't find function ccpartype in your link.)

Names were shortened because I build on the mainframe (MVS) too:

C:\devel\pdos\pdcc>dir *.jcl
Volume in drive C has no label.
Volume Serial Number is 4E58-AF11

Directory of C:\devel\pdos\pdcc

2023-07-23 21:55 6,124 makemvs.jcl

Here is the original name:

C:\devel\pdos\pdcc\cclib>grep cc_parse_type cclib.c
cclib.c: member.type = cc_parse_type(reader);
cclib.c: cc_type cc_parse_type(cc_reader *reader)
cclib.c: param.type = cc_parse_type(reader);
cclib.c: expr.data.cast.type = cc_parse_type(reader);
cclib.c: var.type = cc_parse_type(reader); /* Now parse the type */

C:\devel\pdos\pdcc\cclib>cd include

C:\devel\pdos\pdcc\cclib\include>grep ccpartype '*'
cclib.h: #define cc_parse_type ccpartype

C:\devel\pdos\pdcc\cclib\include>

BFN. Paul.

Re: bart again (UCX64)

<ucprpd$38s6i$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28491&group=comp.lang.c#28491

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 11:58:54 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <ucprpd$38s6i$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 10:58:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3436754"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181k3Pn+lxahc0tRjPKwBdk02ATzQKhbVw="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:4KHf07+AAvUQw84ghlnte4EYiQw=
In-Reply-To: <557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
 by: Bart - Thu, 31 Aug 2023 10:58 UTC

On 30/08/2023 23:54, Paul Edwards wrote:
> Hi Bart.
>
> Next error I have is:
>
> cc64 -c -out:cclib/cclib.obj cclib/cclib.i
> Compiling cclib/cclib.i to cclib/cclib.obj

BTW the -out option is not needed here. The output file uses the same
filename and the same path, just the extension is changed.

So the generated .obj file is in the same folder as the .c or .i source
file. The same applies when generating executables; you can compile code
remotely.

Other C compilers may be different; gcc for example applies the right
extension, but the object file (or executable) is written to the current
directory. And others tend to copy gcc.

(Sorry, this is part of a feud I have between my compiler, and the
quirky way that gcc works.

Apparently whatever gcc does is right, even when it's wrong. If gcc
drives over a cliff, other compilers have to do the same!)

Re: bart again (UCX64)

<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28494&group=comp.lang.c#28494

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:8e02:b0:76e:e65f:3d0a with SMTP id re2-20020a05620a8e0200b0076ee65f3d0amr69852qkn.1.1693485170431;
Thu, 31 Aug 2023 05:32:50 -0700 (PDT)
X-Received: by 2002:a17:902:e74f:b0:1c1:fc5c:b33e with SMTP id
p15-20020a170902e74f00b001c1fc5cb33emr1098548plf.6.1693485170114; Thu, 31 Aug
2023 05:32:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 31 Aug 2023 05:32:49 -0700 (PDT)
In-Reply-To: <ucprpd$38s6i$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=136.158.103.92; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 136.158.103.92
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com> <ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com> <ucprpd$38s6i$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
Subject: Re: bart again (UCX64)
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Thu, 31 Aug 2023 12:32:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Paul Edwards - Thu, 31 Aug 2023 12:32 UTC

On Thursday, August 31, 2023 at 6:59:08 PM UTC+8, Bart wrote:

> BTW the -out option is not needed here. The output file uses the same
> filename and the same path, just the extension is changed.

Ok, thanks for the info.

Next problem I have encountered is this:

With this code:

https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdcc/cpplib/directs.c

Plus this modification:

C:\devel\pdos\pdcc>git diff .
diff --git a/pdcc/cpplib/directs.c b/pdcc/cpplib/directs.c
index 8674a696..bd515203 100644
--- a/pdcc/cpplib/directs.c
+++ b/pdcc/cpplib/directs.c
@@ -792,6 +792,13 @@ void _cpp_init_directives(cpp_reader *reader)
{
unsigned int i;

+printf("in init_directives\n");
+printf("element 0 is %p\n", directives[0].name);
+printf("element 0 alternate is %p\n", &directives[0]);
+printf("element 1 is %p\n", directives[1].name);
+printf("element 1 alternate is %p\n", &directives[1]);
+exit(0);
+ for (i = 0; i < DIRECTIVE_COUNT; i++)
{
cpp_unknown *unknown = cpp_find(reader, directives[i].name,

C:\devel\pdos\pdcc>

I see:

C:\devel\pdos\pdcc>pdcc -E abc.c
in init_directives
element 0 is 0000000000403368
element 0 alternate is 00000000004031F8
element 1 is 0200000000004033
element 1 alternate is 00000000004031F9

C:\devel\pdos\pdcc>type abc.c
int x;

C:\devel\pdos\pdcc>

I shouldn't be getting those high addresses.

The situation has been analyzed by the author of pdld, who says:

The problem seems to be cc64 wrongly accessing an address field.

If you look at .text section relocations in directs.obj, you can find relocation with "printf" with RVA 0x17A (that is the call part of the faulty "printf("element 1 is %p\n", directives[1].name);" line).

In .text section at that address the code is this:
....
48 83 ec 20 sub rsp,0x20
ff 34 25 29 00 00 00 push QWORD PTR ds:0x29 (the cc64 wrongly accessing an address field)
48 b9 19 02 00 00 00 movabs rcx,0x219
00 00 00
5a pop rdx
e8 00 00 00 00 call 0x1f (the call to printf at 0x17A)
....

The 0x29 is wrong and correctly it should be 0x28 what can be seen by looking at .data section at that address.

Are you able to comment on this?

Thanks. Paul.

Re: bart again (UCX64)

<ucq1gd$39q14$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28495&group=comp.lang.c#28495

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 14:36:28 +0200
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <ucq1gd$39q14$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 12:36:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7c3ea83124750b7bb0478a35817b0183";
logging-data="3467300"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yEfOEbjWGC4Z60ZQSF1ep/hQ2d3Xz9gw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:MXLWOAmaxSFo0rdSf88To3IcG98=
Content-Language: en-GB
In-Reply-To: <ucprpd$38s6i$1@dont-email.me>
 by: David Brown - Thu, 31 Aug 2023 12:36 UTC

On 31/08/2023 12:58, Bart wrote:
> On 30/08/2023 23:54, Paul Edwards wrote:
>> Hi Bart.
>>
>> Next error I have is:
>>
>> cc64 -c -out:cclib/cclib.obj cclib/cclib.i
>> Compiling cclib/cclib.i to cclib/cclib.obj
>
>
> BTW the -out option is not needed here. The output file uses the same
> filename and the same path, just the extension is changed.
>
> So the generated .obj file is in the same folder as the .c or .i source
> file. The same applies when generating executables; you can compile code
> remotely.
>
> Other C compilers may be different; gcc for example applies the right
> extension, but the object file (or executable) is written to the current
> directory. And others tend to copy gcc.
>

Putting object files (or other generated files) in the same directory as
the source files is okay for small projects. If you've only got a
half-dozen source files, it can be tidy to keep them all in the same
directory.

If you are doing something bigger you almost invariably want to keep the
source tree and the generated files in separate directories. It makes
it much easier to see what's changed, to clean out object files, to
track source in a revision control system of some kind, to find the
source files amongst all the generated files, etc. Details, of course,
vary by person and project - too many directories and subdirectories
makes it hard to keep an overview of the files, as does too few
directories. This is known as "out of tree builds", and is the norm for
most projects above a certain size.

So whatever your default here - whether it is generating the object file
in the same directory as the source file, or generating it in the
current directory - it will be convenient in some cases, and completely
wrong in other cases.

So IMHO it's a good habit to have an "-out" (or equivalent) option in
your build files - then you know exactly where things are going.

People who use "make" have simple and common shortcuts for this. Since
you prefer not to use "make" or any alternative build system, you might
want to at least add an option to specify an output directory. Then,
for example, "cc64 -c -outdir:build src/file.c" would put the output
object file as "build/src/file.obj". You want to copy the directory
structure in the build directory, since a project written by several
people might coincidentally have matching filenames in different
directories.

Re: bart again (UCX64)

<ucq5gr$3ahqh$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28496&group=comp.lang.c#28496

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 14:45:00 +0100
Organization: A noiseless patient Spider
Lines: 107
Message-ID: <ucq5gr$3ahqh$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me>
<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 13:44:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3491665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QCs3QHUrYmjp7f3jnc/hfRW4ZmBlAjU4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:pmTCxNizqnSec2P8hlKTRHZGXdE=
In-Reply-To: <8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
 by: Bart - Thu, 31 Aug 2023 13:45 UTC

On 31/08/2023 13:32, Paul Edwards wrote:
> On Thursday, August 31, 2023 at 6:59:08 PM UTC+8, Bart wrote:
>
>> BTW the -out option is not needed here. The output file uses the same
>> filename and the same path, just the extension is changed.
>
> Ok, thanks for the info.
>
> Next problem I have encountered is this:
>
> With this code:
>
> https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdcc/cpplib/directs.c
>
> Plus this modification:
>
> C:\devel\pdos\pdcc>git diff .
> diff --git a/pdcc/cpplib/directs.c b/pdcc/cpplib/directs.c
> index 8674a696..bd515203 100644
> --- a/pdcc/cpplib/directs.c
> +++ b/pdcc/cpplib/directs.c
> @@ -792,6 +792,13 @@ void _cpp_init_directives(cpp_reader *reader)
> {
> unsigned int i;
>
> +printf("in init_directives\n");
> +printf("element 0 is %p\n", directives[0].name);
> +printf("element 0 alternate is %p\n", &directives[0]);
> +printf("element 1 is %p\n", directives[1].name);
> +printf("element 1 alternate is %p\n", &directives[1]);
> +exit(0);
> +
> for (i = 0; i < DIRECTIVE_COUNT; i++)
> {
> cpp_unknown *unknown = cpp_find(reader, directives[i].name,
>
> C:\devel\pdos\pdcc>
>
>
> I see:
>
> C:\devel\pdos\pdcc>pdcc -E abc.c
> in init_directives
> element 0 is 0000000000403368
> element 0 alternate is 00000000004031F8
> element 1 is 0200000000004033
> element 1 alternate is 00000000004031F9
>
>
> C:\devel\pdos\pdcc>type abc.c
> int x;
>
> C:\devel\pdos\pdcc>
>
>
>
> I shouldn't be getting those high addresses.
>
>
> The situation has been analyzed by the author of pdld, who says:
>
> The problem seems to be cc64 wrongly accessing an address field.
>
> If you look at .text section relocations in directs.obj, you can find relocation with "printf" with RVA 0x17A (that is the call part of the faulty "printf("element 1 is %p\n", directives[1].name);" line).
>
> In .text section at that address the code is this:
> ...
> 48 83 ec 20 sub rsp,0x20
> ff 34 25 29 00 00 00 push QWORD PTR ds:0x29 (the cc64 wrongly accessing an address field)
> 48 b9 19 02 00 00 00 movabs rcx,0x219
> 00 00 00
> 5a pop rdx
> e8 00 00 00 00 call 0x1f (the call to printf at 0x17A)
> ...
>
> The 0x29 is wrong and correctly it should be 0x28 what can be seen by looking at .data section at that address.
>
>
> Are you able to comment on this?

No, sorry. I gave up on this stuff because I was being drawn into it so
much. 90% of it was having to grapple with complex C source code for
which I don't have the right tools for browsing and searching.

I realise the code generator on BCC is poor, and is buggy, which is why
I kept it as a private tool. (/My/ C code is very conservative; there it
works fine!)

What I will do however is this:

* I will take the BCC project and look at the possibility of replacing
the backend code generator with a new one.

* I can't directly use the one from my own compilers, as C is different:
I normally work with 64-bit intermediates throughout, C is mixed
32/64-bit, but mostly 32 bits

So I will do an evaluation first of how viable it will be, but if I
decide to attempt it, it will take some time so is not an immediate
solution.

That would be a better use of my time than trying to do ad hoc fixes and
patches for bugs I can't easily reproduce anyway.

Note a new backend won't fix any conformance issues. The problem with
(*F)()/F() is borderline; maybe that will fixed. The Block problem
should be. I don't want to touch the front end.

Re: bart again (UCX64)

<ucq86h$3auvq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28497&group=comp.lang.c#28497

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 15:30:42 +0100
Organization: A noiseless patient Spider
Lines: 81
Message-ID: <ucq86h$3auvq$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 14:30:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3505146"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JdH3ow+BIjIAsgFLLrZVHWf0jL+t2TXA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:WvzhBHS50iGdXcyDQ7tpnLaHoxE=
In-Reply-To: <ucq1gd$39q14$1@dont-email.me>
 by: Bart - Thu, 31 Aug 2023 14:30 UTC

On 31/08/2023 13:36, David Brown wrote:
> On 31/08/2023 12:58, Bart wrote:
>> On 30/08/2023 23:54, Paul Edwards wrote:
>>> Hi Bart.
>>>
>>> Next error I have is:
>>>
>>> cc64 -c -out:cclib/cclib.obj cclib/cclib.i
>>> Compiling cclib/cclib.i to cclib/cclib.obj
>>
>>
>> BTW the -out option is not needed here. The output file uses the same
>> filename and the same path, just the extension is changed.
>>
>> So the generated .obj file is in the same folder as the .c or .i
>> source file. The same applies when generating executables; you can
>> compile code remotely.
>>
>> Other C compilers may be different; gcc for example applies the right
>> extension, but the object file (or executable) is written to the
>> current directory. And others tend to copy gcc.
>>
>
> Putting object files (or other generated files) in the same directory as
> the source files is okay for small projects.  If you've only got a
> half-dozen source files, it can be tidy to keep them all in the same
> directory.
>
> If you are doing something bigger you almost invariably want to keep the
> source tree and the generated files in separate directories.  It makes
> it much easier to see what's changed, to clean out object files, to
> track source in a revision control system of some kind, to find the
> source files amongst all the generated files, etc.  Details, of course,
> vary by person and project - too many directories and subdirectories
> makes it hard to keep an overview of the files, as does too few
> directories.  This is known as "out of tree builds", and is the norm for
> most projects above a certain size.
>
> So whatever your default here - whether it is generating the object file
> in the same directory as the source file, or generating it in the
> current directory - it will be convenient in some cases, and completely
> wrong in other cases.

But putting it in the current directory is sloppy. The current location
can be arbitrary (or it might not be writeable):

c:\random>gcc \proj1\foo.c
c:\random>gcc \proj2\bar.c

Here, both compilations generate a.exe. But to cap that, both end up in
c:\random; the second overwrites the first, something you might be
unaware of.

If I do:

c:\random>gcc \proj1\foo.c
c:\random>gcc \proj2\bar.c

then there are three differences from gcc:

(1) The executables are called foo.exe and bar.exe respectively
(2) They are written to their respective folders
(3) The compiler will report exactly what it is doing so there
are fewer surprises:

Compiling \proj1\foo.c to \proj2\foo.exe

You can use -v with gcc, but it is not helpful!

> So IMHO it's a good habit to have an "-out" (or equivalent) option in
> your build files - then you know exactly where things are going.
>
> People who use "make" have simple and common shortcuts for this.  Since
> you prefer not to use "make" or any alternative build system, you might
> want to at least add an option to specify an output directory.  Then,
> for example, "cc64 -c -outdir:build src/file.c"

Actually I have exactly that option, called '-outpath', but in my main
compilers; I haven't put it into bcc because bcc is an older project.

Re: bart again (UCX64)

<PC1IM.472122$xMqa.233853@fx12.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28498&group=comp.lang.c#28498

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: bart again (UCX64)
Newsgroups: comp.lang.c
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me> <a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me> <d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me> <65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com> <ucoe3l$2t4o2$1@dont-email.me> <557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com> <ucprpd$38s6i$1@dont-email.me> <8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
Lines: 12
Message-ID: <PC1IM.472122$xMqa.233853@fx12.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Thu, 31 Aug 2023 14:39:43 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Thu, 31 Aug 2023 14:39:43 GMT
X-Received-Bytes: 1420
 by: Scott Lurndal - Thu, 31 Aug 2023 14:39 UTC

Paul Edwards <mutazilah@gmail.com> writes:
>On Thursday, August 31, 2023 at 6:59:08=E2=80=AFPM UTC+8, Bart wrote:
>
>> BTW the -out option is not needed here. The output file uses the same=20
>> filename and the same path, just the extension is changed.
>
>Ok, thanks for the info.
>
>Next problem I have encountered is this:

Please take it to email. This is not relevent to comp.lang.c.

Re: bart again (UCX64)

<31bf11a1-03d5-4ed2-8af0-0d2aeb471292n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28499&group=comp.lang.c#28499

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:8c3:b0:63f:8aaf:164c with SMTP id da3-20020a05621408c300b0063f8aaf164cmr79601qvb.8.1693492992550;
Thu, 31 Aug 2023 07:43:12 -0700 (PDT)
X-Received: by 2002:a17:903:2312:b0:1c0:760b:b5c3 with SMTP id
d18-20020a170903231200b001c0760bb5c3mr1170343plh.13.1693492991956; Thu, 31
Aug 2023 07:43:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 31 Aug 2023 07:43:11 -0700 (PDT)
In-Reply-To: <ucq5gr$3ahqh$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=136.158.103.92; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 136.158.103.92
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com> <ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com> <ucprpd$38s6i$1@dont-email.me>
<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com> <ucq5gr$3ahqh$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <31bf11a1-03d5-4ed2-8af0-0d2aeb471292n@googlegroups.com>
Subject: Re: bart again (UCX64)
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Thu, 31 Aug 2023 14:43:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3238
 by: Paul Edwards - Thu, 31 Aug 2023 14:43 UTC

On Thursday, August 31, 2023 at 9:45:14 PM UTC+8, Bart wrote:

> I realise the code generator on BCC is poor, and is buggy, which is why
> I kept it as a private tool. (/My/ C code is very conservative; there it
> works fine!)

Ok, thanks. I'll see if I can rework the C code to be conservative.

> So I will do an evaluation first of how viable it will be, but if I
> decide to attempt it, it will take some time so is not an immediate
> solution.

Sure. No problem. And no expectations.

This is already a decades-long endeavor anyway. It's more just
trying to understand where we stand after this latest breakthrough.

> That would be a better use of my time than trying to do ad hoc fixes and
> patches for bugs I can't easily reproduce anyway.

You should be able to reproduce my results.

I have uploaded http://pdos.org/uc386.zip which has all the
executables that get executed when running makefile.n64.
Plus it has the source code itself, so that you don't need to
go to sourceforge.

Also note that since producing the above, I have committed
a bit more development to sourceforge, but nothing related
to or that affects this issue.

> Note a new backend won't fix any conformance issues. The problem with
> (*F)()/F() is borderline; maybe that will fixed. The Block problem
> should be. I don't want to touch the front end.

Sure. The new cc64 (if it arrives) will still be public domain
though, right?

Thanks. Paul.

Re: bart again (UCX64)

<ucq9ni$3b3hm$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28500&group=comp.lang.c#28500

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 15:56:52 +0100
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <ucq9ni$3b3hm$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me>
<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
<ucq5gr$3ahqh$1@dont-email.me>
<31bf11a1-03d5-4ed2-8af0-0d2aeb471292n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 14:56:50 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3509814"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+j+GszW3Femni4doJuH09EUrS7/wEVHlQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:rDypeR8UE4rHmTtCW9aEGd1KsPM=
In-Reply-To: <31bf11a1-03d5-4ed2-8af0-0d2aeb471292n@googlegroups.com>
 by: Bart - Thu, 31 Aug 2023 14:56 UTC

On 31/08/2023 15:43, Paul Edwards wrote:
> On Thursday, August 31, 2023 at 9:45:14 PM UTC+8, Bart wrote:
>
>> I realise the code generator on BCC is poor, and is buggy, which is why
>> I kept it as a private tool. (/My/ C code is very conservative; there it
>> works fine!)
>
> Ok, thanks. I'll see if I can rework the C code to be conservative.
>
>> So I will do an evaluation first of how viable it will be, but if I
>> decide to attempt it, it will take some time so is not an immediate
>> solution.
>
> Sure. No problem. And no expectations.
>
> This is already a decades-long endeavor anyway. It's more just
> trying to understand where we stand after this latest breakthrough.
>
>> That would be a better use of my time than trying to do ad hoc fixes and
>> patches for bugs I can't easily reproduce anyway.
>
> You should be able to reproduce my results.
>
> I have uploaded http://pdos.org/uc386.zip which has all the
> executables that get executed when running makefile.n64.
> Plus it has the source code itself, so that you don't need to
> go to sourceforge.
>
> Also note that since producing the above, I have committed
> a bit more development to sourceforge, but nothing related
> to or that affects this issue.
>
>> Note a new backend won't fix any conformance issues. The problem with
>> (*F)()/F() is borderline; maybe that will fixed. The Block problem
>> should be. I don't want to touch the front end.
>
> Sure. The new cc64 (if it arrives) will still be public domain
> though, right?

It can be. (Personally I don't care about that aspect at all.)

I can confirm that I've started an overhaul of the project, which will
have a working title of 'DD' to distinguish it from 'CC'. The first
stage is to get it to generate a new intermediate (IL) code (perhaps
within a week).

If that looks promising, then I need to turn that into ASM code. That is
likely to smaller, faster, fully ABI-conforming, and with hopefully
fewer bugs.

Re: bart again (UCX64)

<ucqaub$3bcsk$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28501&group=comp.lang.c#28501

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 16:17:31 +0100
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <ucqaub$3bcsk$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 15:17:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3519380"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hQt3nNg4jKL/PyG9GcDBztrdKxgLk4uA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:SiU7kzu+Yn6VlPKWF6P2ML99cFY=
In-Reply-To: <ucq86h$3auvq$1@dont-email.me>
 by: Bart - Thu, 31 Aug 2023 15:17 UTC

On 31/08/2023 15:30, Bart wrote:
> On 31/08/2023 13:36, David Brown wrote:
>> On 31/08/2023 12:58, Bart wrote:
>>> On 30/08/2023 23:54, Paul Edwards wrote:
>>>> Hi Bart.
>>>>
>>>> Next error I have is:
>>>>
>>>> cc64 -c -out:cclib/cclib.obj cclib/cclib.i
>>>> Compiling cclib/cclib.i to cclib/cclib.obj
>>>
>>>
>>> BTW the -out option is not needed here. The output file uses the same
>>> filename and the same path, just the extension is changed.
>>>
>>> So the generated .obj file is in the same folder as the .c or .i
>>> source file. The same applies when generating executables; you can
>>> compile code remotely.
>>>
>>> Other C compilers may be different; gcc for example applies the right
>>> extension, but the object file (or executable) is written to the
>>> current directory. And others tend to copy gcc.
>>>
>>
>> Putting object files (or other generated files) in the same directory
>> as the source files is okay for small projects.  If you've only got a
>> half-dozen source files, it can be tidy to keep them all in the same
>> directory.
>>
>> If you are doing something bigger you almost invariably want to keep
>> the source tree and the generated files in separate directories.  It
>> makes it much easier to see what's changed, to clean out object files,
>> to track source in a revision control system of some kind, to find the
>> source files amongst all the generated files, etc.  Details, of
>> course, vary by person and project - too many directories and
>> subdirectories makes it hard to keep an overview of the files, as does
>> too few directories.  This is known as "out of tree builds", and is
>> the norm for most projects above a certain size.
>>
>> So whatever your default here - whether it is generating the object
>> file in the same directory as the source file, or generating it in the
>> current directory - it will be convenient in some cases, and
>> completely wrong in other cases.
>
> But putting it in the current directory is sloppy. The current location
> can be arbitrary (or it might not be writeable):
>
>  c:\random>gcc \proj1\foo.c
>  c:\random>gcc \proj2\bar.c
>
> Here, both compilations generate a.exe. But to cap that, both end up in
> c:\random; the second overwrites the first, something you might be
> unaware of.
>
> If I do:
>
>  c:\random>gcc \proj1\foo.c
>  c:\random>gcc \proj2\bar.c
>
> then there are three differences from gcc:

This is not necessarily a typo due to forgetting to change 'gcc' to
'bcc'. I could have decided to rename 'bcc.exe' to 'gcc.exe' for this test.

Re: bart again (UCX64)

<25fdb458-7915-4506-b80f-69569e687368n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28502&group=comp.lang.c#28502

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:1115:b0:412:2efa:bec7 with SMTP id e21-20020a05622a111500b004122efabec7mr94891qty.4.1693496287835;
Thu, 31 Aug 2023 08:38:07 -0700 (PDT)
X-Received: by 2002:a05:6a00:2daa:b0:68c:8d6c:8fca with SMTP id
fb42-20020a056a002daa00b0068c8d6c8fcamr11477pfb.1.1693496287106; Thu, 31 Aug
2023 08:38:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 31 Aug 2023 08:38:06 -0700 (PDT)
In-Reply-To: <ucq9ni$3b3hm$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=136.158.103.92; posting-account=CeHKkQoAAAAowY1GfiJYG55VVc0s1zaG
NNTP-Posting-Host: 136.158.103.92
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com> <uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com> <ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com> <ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com> <ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com> <ucprpd$38s6i$1@dont-email.me>
<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com> <ucq5gr$3ahqh$1@dont-email.me>
<31bf11a1-03d5-4ed2-8af0-0d2aeb471292n@googlegroups.com> <ucq9ni$3b3hm$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <25fdb458-7915-4506-b80f-69569e687368n@googlegroups.com>
Subject: Re: bart again (UCX64)
From: mutazi...@gmail.com (Paul Edwards)
Injection-Date: Thu, 31 Aug 2023 15:38:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 7407
 by: Paul Edwards - Thu, 31 Aug 2023 15:38 UTC

On Thursday, August 31, 2023 at 10:57:05 PM UTC+8, Bart wrote:

> > Sure. The new cc64 (if it arrives) will still be public domain
> > though, right?

> It can be. (Personally I don't care about that aspect at all.)

If you don't care, then please keep it public domain, because
that is the whole point - I care, and I am working with people
who care. And all the people I work with have attempted or
are still attempting to write a public domain C90-compliant
compiler, but nobody has reached cc64 level yet.

> I can confirm that I've started an overhaul of the project, which will
> have a working title of 'DD' to distinguish it from 'CC'. The first
> stage is to get it to generate a new intermediate (IL) code (perhaps
> within a week).
>
> If that looks promising, then I need to turn that into ASM code. That is
> likely to smaller, faster, fully ABI-conforming, and with hopefully
> fewer bugs.

Ok, cool.

Note that it was suggested to take this to email, but I
personally don't think it is off-topic. If you do, my email
address is mutazilah AT gmail DOT com.

I have a new problem regardless.

C:\devel\pdos\pdmake>pdmake -f makefile.n64
rm -f main.obj read.obj rule.obj variable.obj xmalloc.obj hashtab.obj ../pdpclib/x64supb.obj pdmake.exe
pdcc -E -I. -I./hashtab -I../pdpclib -D__WIN32__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -o main.i main.c
cc64 -c -out:main.obj main.i
Compiling main.i to main.obj
rm -f main.i
pdcc -E -I. -I./hashtab -I../pdpclib -D__WIN32__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -o read.i read.c
cc64 -c -out:read.obj read.i
Compiling read.i to read.obj
rm -f read.i
pdcc -E -I. -I./hashtab -I../pdpclib -D__WIN32__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -o rule.i rule.c
cc64 -c -out:rule.obj rule.i
Compiling rule.i to rule.obj
rm -f rule.i
pdcc -E -I. -I./hashtab -I../pdpclib -D__WIN32__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -o variable.i variable.c
cc64 -c -out:variable.obj variable.i
Compiling variable.i to variable.obj
rm -f variable.i
pdcc -E -I. -I./hashtab -I../pdpclib -D__WIN32__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -o xmalloc.i xmalloc.c
cc64 -c -out:xmalloc.obj xmalloc.i
Compiling xmalloc.i to xmalloc.obj
rm -f xmalloc.i
pdcc -E -I. -I./hashtab -I../pdpclib -D__WIN32__ -D__NOBIVA__ -D__64BIT__ -D__CC64__ -o ./hashtab/hashtab.i ./hashtab/hashtab.c
cc64 -c -out:hashtab.obj ./hashtab/hashtab.i
Compiling ./hashtab/hashtab.i to hashtab.obj
rm -f ./hashtab/hashtab.i
pdld -s -nostdlib --no-insert-timestamp --image-base 0x400000 -o pdmake.exe ../pdpclib/w32start.obj main.obj read.obj rule.obj variable.obj xmalloc.obj hashtab.obj ../pdpclib/x64supb.obj ../pdpclib/msvcrt.lib

C:\devel\pdos\pdmake>pdmake --help
before

C:\devel\pdos\pdmake>

C:\devel\pdos\pdmake>git diff .
diff --git a/pdmake/hashtab/hashtab.c b/pdmake/hashtab/hashtab.c
index 57184ed4..00e43d9b 100644
--- a/pdmake/hashtab/hashtab.c
+++ b/pdmake/hashtab/hashtab.c
@@ -18,6 +18,7 @@

#include <math.h>
#include <stddef.h>
+#include <stdio.h>

#include "hashtab.h"

@@ -85,6 +86,7 @@ static int rehash (struct hashtab *hashtab, size_t target_size)
{
struct hashtab old_hashtab = *hashtab;
struct hashtab_entry *entry;
+ double ggg;

size_t i;

@@ -96,6 +98,11 @@ static int rehash (struct hashtab *hashtab, size_t target_size)
}

hashtab->probe_limit = max (internal_log2 (hashtab->size), MINIMAL_PROBE_LIMIT);
+ + printf("before\n");
+ ggg = hashtab->max_load_factor * hashtab->size;
+ printf("after\n");
+ hashtab->max_number_of_elements = ceil (hashtab->max_load_factor * hashtab->size);

/* Allocates size + probe_limit + 1 so no bounds checking needs to be done. */

C:\devel\pdos\pdmake>

A double multiplied by a long long is crashing.

If I cast the long long to int, it doesn't crash.

Code is all in sourceforge.

Note that it could be related to the assembler support
routines. We have converted some of your bcclib.asm
into intel syntax, which can be found here:

https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/x64supb.asm

And relevant stuff copied here, in case you can see
something we have done wrong in the conversion:

# These routines were copied (and then modified) from bcclib.asm generated
# by the public domain cc64, and are used for cc64
# (Converted to PDAS .intel_syntax noprefix by guessing.)

..globl m$ufloat_r64u32
m$ufloat_r64u32:
mov ecx, ecx # clear top half (already done if value just moved there)
cvtsi2sd xmm15, rcx
ret

..globl m$ufloat_r32u32
m$ufloat_r32u32:
mov ecx, ecx
cvtsi2ss xmm15, rcx
ret

..globl m$ufloat_r64u64
m$ufloat_r64u64:
cmp ecx, 0
jl fl1
#number is positive, so can treat like i64
cvtsi2sd xmm15, rcx
ret
fl1: #negative value
and rcx, QWORD PTR mask63[rip] #clear top bit (subtract 2**63)
cvtsi2sd xmm15, rcx
addsd xmm15, QWORD PTR offset64[rip] #(add 2**63 back to result)
ret

..globl m$ufloat_r32u64
m$ufloat_r32u64:
cmp ecx, 0
jl fl2
#number is positive, so can treat like i64
cvtsi2ss xmm15, rcx
ret
fl2: #negative value
and rcx, QWORD PTR mask63[rip] #clear top bit (subtract 2**63)
cvtsi2ss xmm15, rcx
addss xmm15, DWORD PTR offset32[rip] #(add 2**63 back to result)
ret

..section rdata
mask63:
.quad 0x7fffffffffffffff
offset64:
.quad 9223372036854775808 # 2**63 as r64
offset32:
.quad 9223372036854775808 # 2**63 as r32

Thanks. Paul.

Re: bart again (UCX64)

<ucqj27$3con1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28503&group=comp.lang.c#28503

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 19:36:07 +0200
Organization: A noiseless patient Spider
Lines: 115
Message-ID: <ucqj27$3con1$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 17:36:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a1ec5ac08a6d9b895b734a3b8462fdf1";
logging-data="3564257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+e9HTS6x0hlRvghtbhjXEzDhmrJ/QLoAU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:IicQm96GlNx4YtRyua/YRwgoU+A=
Content-Language: en-GB
In-Reply-To: <ucq86h$3auvq$1@dont-email.me>
 by: David Brown - Thu, 31 Aug 2023 17:36 UTC

On 31/08/2023 16:30, Bart wrote:
> On 31/08/2023 13:36, David Brown wrote:
>> On 31/08/2023 12:58, Bart wrote:
>>> On 30/08/2023 23:54, Paul Edwards wrote:
>>>> Hi Bart.
>>>>
>>>> Next error I have is:
>>>>
>>>> cc64 -c -out:cclib/cclib.obj cclib/cclib.i
>>>> Compiling cclib/cclib.i to cclib/cclib.obj
>>>
>>>
>>> BTW the -out option is not needed here. The output file uses the same
>>> filename and the same path, just the extension is changed.
>>>
>>> So the generated .obj file is in the same folder as the .c or .i
>>> source file. The same applies when generating executables; you can
>>> compile code remotely.
>>>
>>> Other C compilers may be different; gcc for example applies the right
>>> extension, but the object file (or executable) is written to the
>>> current directory. And others tend to copy gcc.
>>>
>>
>> Putting object files (or other generated files) in the same directory
>> as the source files is okay for small projects.  If you've only got a
>> half-dozen source files, it can be tidy to keep them all in the same
>> directory.
>>
>> If you are doing something bigger you almost invariably want to keep
>> the source tree and the generated files in separate directories.  It
>> makes it much easier to see what's changed, to clean out object files,
>> to track source in a revision control system of some kind, to find the
>> source files amongst all the generated files, etc.  Details, of
>> course, vary by person and project - too many directories and
>> subdirectories makes it hard to keep an overview of the files, as does
>> too few directories.  This is known as "out of tree builds", and is
>> the norm for most projects above a certain size.
>>
>> So whatever your default here - whether it is generating the object
>> file in the same directory as the source file, or generating it in the
>> current directory - it will be convenient in some cases, and
>> completely wrong in other cases.
>
> But putting it in the current directory is sloppy. The current location
> can be arbitrary (or it might not be writeable):
>
>  c:\random>gcc \proj1\foo.c
>  c:\random>gcc \proj2\bar.c
>

So don't do that.

Make sure you are in the appropriate directory, then compile - or give
the output file name directly. As I said, whatever default you use, it
will be wrong sometimes.

> Here, both compilations generate a.exe. But to cap that, both end up in
> c:\random; the second overwrites the first, something you might be
> unaware of.

If you are not aware of that, you'll learn pretty quickly!

>
> If I do:
>
>  c:\random>gcc \proj1\foo.c
>  c:\random>gcc \proj2\bar.c
>
> then there are three differences from gcc:
>
>  (1) The executables are called foo.exe and bar.exe respectively
>  (2) They are written to their respective folders
>  (3) The compiler will report exactly what it is doing so there
>      are fewer surprises:
>
>      Compiling \proj1\foo.c to \proj2\foo.exe
>
> You can use -v with gcc, but it is not helpful!

Nor is it helpful for the compiler to tell me what it is doing -
generally I know what it is doing - it is doing what I told it to do.
It is only if it can't do that (due to some error) that I want to be told.

Again, different defaults suit different uses and different people.
Plenty of gcc's defaults are inappropriate for me, and I think should be
different - but your compiler's defaults are no better. You only
/think/ that your compiler's defaults are good, because they suit you
personally - don't expect them to be ideal for anyone else. For any big
program, excluding ones they write themselves to use themselves, some of
the default settings will be sub-optimal or unusable.

So your compiler's defaults are not worse than any others, nor are they
better - except for your own personal tastes.

>
>> So IMHO it's a good habit to have an "-out" (or equivalent) option in
>> your build files - then you know exactly where things are going.
>>
>> People who use "make" have simple and common shortcuts for this.
>> Since you prefer not to use "make" or any alternative build system,
>> you might want to at least add an option to specify an output
>> directory.  Then, for example, "cc64 -c -outdir:build src/file.c"
>
> Actually I have exactly that option, called '-outpath', but in my main
> compilers; I haven't put it into bcc because bcc is an older project.
>

Fair enough.

Do you also have a "-quiet" option to hide non-essential messages?
That's also something I like in compilers and other tools, if it is not
the default - though again, preferences vary.

Re: bart again (UCX64)

<20230831120802.994@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28505&group=comp.lang.c#28505

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 19:17:06 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <20230831120802.994@kylheku.com>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me>
Injection-Date: Thu, 31 Aug 2023 19:17:06 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70d02f2c57901333f8c8fdfdb470c4f7";
logging-data="3590096"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gpZUYESXYqNzdPY4Qf+lv4Eo+W1P1TKM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:A165xklqGgSqDdIzQnAMSsJ8M8M=
 by: Kaz Kylheku - Thu, 31 Aug 2023 19:17 UTC

On 2023-08-31, Bart <bc@freeuk.com> wrote:
> On 31/08/2023 13:36, David Brown wrote:
>> So whatever your default here - whether it is generating the object file
>> in the same directory as the source file, or generating it in the
>> current directory - it will be convenient in some cases, and completely
>> wrong in other cases.
>
> But putting it in the current directory is sloppy. The current location
> can be arbitrary (or it might not be writeable):
>
> c:\random>gcc \proj1\foo.c
> c:\random>gcc \proj2\bar.c
>
> Here, both compilations generate a.exe. But to cap that, both end up in
> c:\random; the second overwrites the first, something you might be
> unaware of.

Nobody cares about this in the world of building components from C.

The build systems by and large operate from the assumption that
the current working directory is the top-level build directory.

If you do

$ make -f /path/to/project/build/Makefile

it will not work. The correct ways, if you're not in that
directory are any of these:

$ cd /path/to/project/build; make

or

$ make -C /path/to/project/build

or, if the name of the makefile is nonstandard:

$ make -C /path/to/project/build -f Makefile.foo

The argument to -f is considered from the directory that
was changed into with -C.

While you could probably make a Makefile that can be dispatched from
anywhere without changing the current working directory, I suspect there
is zero demand.

If you end up feeding resolvd, absolute paths to your tools, that's
actually a negative. The __FILE__ macro resolves to something that
makes no ssense on the target system where the program is running
like "/home/bob/open-source-projects/foo/src/parsere.c"instead of just
"src/parser.c".

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: bart again (UCX64)

<ucqpgp$3dnop$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28506&group=comp.lang.c#28506

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 20:26:18 +0100
Organization: A noiseless patient Spider
Lines: 91
Message-ID: <ucqpgp$3dnop$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me> <ucqj27$3con1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 31 Aug 2023 19:26:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3596057"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Mp0mv439c714rqLi1NIc2klSLr+OPLfM="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:5lJis3bx28YrBhc+GoPEFdr5qwg=
In-Reply-To: <ucqj27$3con1$1@dont-email.me>
 by: Bart - Thu, 31 Aug 2023 19:26 UTC

On 31/08/2023 18:36, David Brown wrote:
> On 31/08/2023 16:30, Bart wrote:
>> On 31/08/2023 13:36, David Brow

>> But putting it in the current directory is sloppy. The current
>> location can be arbitrary (or it might not be writeable):
>>
>>   c:\random>gcc \proj1\foo.c
>>   c:\random>gcc \proj2\bar.c
>>
>
> So don't do that.
>
> Make sure you are in the appropriate directory, then compile - or give
> the output file name directly.  As I said, whatever default you use, it
> will be wrong sometimes.

But it's an extra thing that could be easily have been done right.
Compilers work for us, not us for them.

Suppose gcc decided to put the output files in a root directory, or some
place where it would be a very bad idea to write or overwrite a file.

You can't just fob people off with 'So don't do that'; it needs to be
fixed. But then neither can you further fob them off with: 'It's always
done that, and further, one person in 1000, or some makefile from 1974,
depends on it, so we can't change it, ever'.

>> Here, both compilations generate a.exe. But to cap that, both end up
>> in c:\random; the second overwrites the first, something you might be
>> unaware of.
>
> If you are not aware of that, you'll learn pretty quickly!

It may not have crossed your mind, or if it had, your might assume that
two distinct a.exe files were produced.

>>
>> If I do:
>>
>>   c:\random[gcc \proj1\foo.c
>>   c:\random>gcc \proj2\bar.c
>>
>> then there are three differences from gcc:
>>
>>   (1) The executables are called foo.exe and bar.exe respectively
>>   (2) They are written to their respective folders
>>   (3) The compiler will report exactly what it is doing so there
>>       are fewer surprises:
>>
>>       Compiling \proj1\foo.c to \proj2\foo.exe
>>
>> You can use -v with gcc, but it is not helpful!
>
> Nor is it helpful for the compiler to tell me what it is doing -

If the compiler is doing multiple files, especially a slow compiler,
then it is highly useful to know where it's up to, or what it's stuck on.

But this seems to be a Linux thing: if I do 'cp *.c dest', then nothing
is output, until you get the prompt back. So, did work, did it copy
anything, was it one big file, or lots of small ones?

If I do 'copy *.c test' on Windows, it shows each file copied, and it
tells how many files were copied in all. The 'cp' command needs '-v' to
force to show what it's doing.

The defaults are backwards.

> generally I know what it is doing - it is doing what I told it to do. It
> is only if it can't do that (due to some error) that I want to be told.
>
> Again, different defaults suit different uses and different people.
> Plenty of gcc's defaults are inappropriate for me, and I think should be
> different - but your compiler's defaults are no better.  You only
> /think/ that your compiler's defaults are good, because they suit you
> personally

No, they make more sense for casual use from a command line for anybody.

> Do you also have a "-quiet" option to hide non-essential messages?
> That's also something I like in compilers and other tools, if it is not
> the default - though again, preferences vary.

Yes, I think it's -q. If a lot of files are being processed, then you
might want to turn it off (or if timing, it can make a small difference).

However gcc's -v option generates 40 times as much output as my compiler
without -q. So it's either far too verbose, or not enough.

Re: bart again (UCX64)

<20230831121856.53@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28507&group=comp.lang.c#28507

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 19:28:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 98
Message-ID: <20230831121856.53@kylheku.com>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me> <20230831120802.994@kylheku.com>
Injection-Date: Thu, 31 Aug 2023 19:28:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70d02f2c57901333f8c8fdfdb470c4f7";
logging-data="3590096"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jGCf235C+gWPIUMXAjPh0KQnPq90eZnI="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:1y74TKqKqpGRbqAphMI7BS5dPIo=
 by: Kaz Kylheku - Thu, 31 Aug 2023 19:28 UTC

On 2023-08-31, Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> On 2023-08-31, Bart <bc@freeuk.com> wrote:
>> On 31/08/2023 13:36, David Brown wrote:
>>> So whatever your default here - whether it is generating the object file
>>> in the same directory as the source file, or generating it in the
>>> current directory - it will be convenient in some cases, and completely
>>> wrong in other cases.
>>
>> But putting it in the current directory is sloppy. The current location
>> can be arbitrary (or it might not be writeable):
>>
>> c:\random>gcc \proj1\foo.c
>> c:\random>gcc \proj2\bar.c
>>
>> Here, both compilations generate a.exe. But to cap that, both end up in
>> c:\random; the second overwrites the first, something you might be
>> unaware of.
>
> Nobody cares about this in the world of building components from C.
>
> The build systems by and large operate from the assumption that
> the current working directory is the top-level build directory.

In fact, I should add, there is a practice of separating source
and build directories.

Any properly constructed AutoConf project supports this:

$ mkdir build-dir
$ cd build-dir
build-dir $ /path/to/some/project/configure

You create a build directory and call a configure script located
elsewhere. It prepares that build directory for building the program.

build-dir $ make

The build references source files in /path/to/some/project.

It drops object files here, inthis directory. Or some child like obj/
depending on the exact build system.

You don't want to be dropping binaries in the sae place where the
sources are located.

*THAT* location may be read-only!

Building sources that sit on a read-only mounted filesystem is a thing.

The MIT XWindow system devised a scheme for dealing with this: the lndir
utility.

With lndir, you create a parallel tree to the target source tree,
populated with symlinks:

$ mkdir build-dir
$ cd build-dir
build-dir$ lndir /path/to/some/project .

A directory structure skeleton is created mirroring that of the
target projet, and populated with symlinks to each of its files.

lndir's man page says:

"This is usually useful for maintaining source code for different
machine architectures. You create a shadow directory containing links
to the real source, which you will have usually mounted from a
remote machine."

I was once employed producing a from-scratch embedded Linux distro,
and doing kernel work, toolchain support and such.

I religiously used separate build directories for everything I built.
A few programs refused to cooperate. For those that couldn't be patched,
I reached for lndir.

The Linux kernel cannot (or couldn't at the time?) support separate
build directories; I used lndir and it worked like a charm. That allowed
me to build the same tree for x86 and MIPS without its cooperation.

(The one thing that defeated lndir was that goddamed ASDF build system
for Common Lisp. Internally, it called (truepath ...) which resolves
all symlinks, and then it calculated object paths from the resolved
source paths.)

But anyway, if you're sitting in a different tree from where your
source files are, you rarely want object files to be pooped into
that tree, instead of this one here.

If you do, you're an oddball, and nobody will listen to you;
they will say, just change to that directory and work there.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: bart again (UCX64)

<ucqqum$3du9m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28509&group=comp.lang.c#28509

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 20:50:47 +0100
Organization: A noiseless patient Spider
Lines: 102
Message-ID: <ucqqum$3du9m$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me> <20230831120802.994@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 19:50:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3602742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DP89JjxyHaWqvcb2dOfS8xE78VF9ERtY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:21EX4mTlZG6TcHeOCfEr3usu27U=
In-Reply-To: <20230831120802.994@kylheku.com>
 by: Bart - Thu, 31 Aug 2023 19:50 UTC

On 31/08/2023 20:17, Kaz Kylheku wrote:
> On 2023-08-31, Bart <bc@freeuk.com> wrote:
>> On 31/08/2023 13:36, David Brown wrote:
>>> So whatever your default here - whether it is generating the object file
>>> in the same directory as the source file, or generating it in the
>>> current directory - it will be convenient in some cases, and completely
>>> wrong in other cases.
>>
>> But putting it in the current directory is sloppy. The current location
>> can be arbitrary (or it might not be writeable):
>>
>> c:\random>gcc \proj1\foo.c
>> c:\random>gcc \proj2\bar.c
>>
>> Here, both compilations generate a.exe. But to cap that, both end up in
>> c:\random; the second overwrites the first, something you might be
>> unaware of.
>
> Nobody cares about this in the world of building components from C.

I guess that's because people using off-the-shelf tools are forced to do
things the way the tools dictate. They don't have a choice!

After a while they become inured enough to think that's the only way it
can be.

>
> The build systems by and large operate from the assumption that
> the current working directory is the top-level build directory.

So, you have to build things in-situ. To build multiple projects, you
have to navigate from folder to folder.

Whereas I can build all my language projects from one location, for example:

c:\demo>mm \ax\aa
Compiling \ax\aa.m------ to \ax\aa.exe

c:\demo>mm \cx\cc
Compiling \cx\cc.m------ to \cx\cc.exe

c:\demo>mm \qx\qq
Compiling \qx\qq.m------ to \qx\qq.exe

c:\demo>mm \mx\mm
Compiling \mx\mm.m------ to \mx\mm.exe

> If you do
>
> $ make -f /path/to/project/build/Makefile
>
> it will not work.

Why doesn't the tool just navigate to that path? And maybe, navigate
back to the start point when it's done?

Oh, I get it, 'zero demand'!

(You can see I don't use makefiles; most of them would consist of one line.)

The correct ways, if you're not in that
> directory are any of these:
>
> $ cd /path/to/project/build; make
>
> or
>
> $ make -C /path/to/project/build
>
> or, if the name of the makefile is nonstandard:
>
> $ make -C /path/to/project/build -f Makefile.foo
>
> The argument to -f is considered from the directory that
> was changed into with -C.
>
> While you could probably make a Makefile that can be dispatched from
> anywhere without changing the current working directory, I suspect there
> is zero demand.

I was right...

> If you end up feeding resolvd, absolute paths to your tools, that's
> actually a negative. The __FILE__ macro resolves to something that
> makes no ssense on the target system where the program is running
> like "/home/bob/open-source-projects/foo/src/parsere.c"instead of just
> "src/parser.c".

__FILE__ is a compile-time thing. But people do feed absolute or
sometimes relative paths to their compilers; the OP did so for example.

Also, that Baby X RC project was built with a command line like this:

gcc *.c abc\*.c def\*.c

Whatever path is provided for a source file, is what ends up as a a
prefix to __FILE__. You don't want a dozen files, all called foo.c but
in different folders, to all show "foo.c" in their __FILE__ macros; that
is not helpful!

Re: bart again (UCX64)

<87sf7z7zqf.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28510&group=comp.lang.c#28510

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 12:56:08 -0700
Organization: None to speak of
Lines: 16
Message-ID: <87sf7z7zqf.fsf@nosuchdomain.example.com>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me>
<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
<ucq5gr$3ahqh$1@dont-email.me>
<31bf11a1-03d5-4ed2-8af0-0d2aeb471292n@googlegroups.com>
<ucq9ni$3b3hm$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="e8d899b8fafb490ef1d8e527231431ae";
logging-data="3600532"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DpApQm/vNN1R7oeoFLnWM"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:mglGjmYMpFkCEcVcN4KZxm5sdCQ=
sha1:4WLUQXs7dm1xYFtIjQ0dRu9tB9A=
 by: Keith Thompson - Thu, 31 Aug 2023 19:56 UTC

Bart <bc@freeuk.com> writes:
[...]
> I can confirm that I've started an overhaul of the project, which will
> have a working title of 'DD' to distinguish it from 'CC'. The first
> stage is to get it to generate a new intermediate (IL) code (perhaps
> within a week).

There's a common Unix file conversion tool called "dd". Do whatever you
like with that information.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/dd.html

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: bart again (UCX64)

<87r0njkmue.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28511&group=comp.lang.c#28511

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 20:56:09 +0100
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <87r0njkmue.fsf@bsb.me.uk>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me>
<8e7740e0-c601-481f-ad11-2893b54fd44an@googlegroups.com>
<PC1IM.472122$xMqa.233853@fx12.iad>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="b4e95399c10c70c93d0dbe52083af2de";
logging-data="3601283"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aeumsM2nTvQ+QPUi4wIKzOWKNXF7dZWk="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:lmrh/C8NCy2KJOZpbaHeb2k1EFE=
sha1:c2kt8aQYXXyC5l+cEjbwa6+aVfw=
X-BSB-Auth: 1.4b5f12e60953b09d0844.20230831205609BST.87r0njkmue.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 31 Aug 2023 19:56 UTC

scott@slp53.sl.home (Scott Lurndal) writes:

> Paul Edwards <mutazilah@gmail.com> writes:

>>Ok, thanks for the info.
>>
>>Next problem I have encountered is this:
>
> Please take it to email. This is not relevent to comp.lang.c.

It is certainly niche, but it's all about C. I'd say these posts are
among the most topical there have been in a while. As it happens, they
don't interest me much, but that not the same thing at all.

--
Ben.

Re: bart again (UCX64)

<ucqrma$3e1l4$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28512&group=comp.lang.c#28512

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (Bart)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 21:03:23 +0100
Organization: A noiseless patient Spider
Lines: 125
Message-ID: <ucqrma$3e1l4$1@dont-email.me>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me> <20230831120802.994@kylheku.com>
<20230831121856.53@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 20:03:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6baea563dabcc6feb0578ed89d47fe";
logging-data="3606180"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//zOysFge4paVba0FdtbNAQDKQ7yPoq+E="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Cancel-Lock: sha1:MYe6XwvB9yTKd52SINzyBeJtn94=
In-Reply-To: <20230831121856.53@kylheku.com>
 by: Bart - Thu, 31 Aug 2023 20:03 UTC

On 31/08/2023 20:28, Kaz Kylheku wrote:
> On 2023-08-31, Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>> On 2023-08-31, Bart <bc@freeuk.com> wrote:
>>> On 31/08/2023 13:36, David Brown wrote:
>>>> So whatever your default here - whether it is generating the object file
>>>> in the same directory as the source file, or generating it in the
>>>> current directory - it will be convenient in some cases, and completely
>>>> wrong in other cases.
>>>
>>> But putting it in the current directory is sloppy. The current location
>>> can be arbitrary (or it might not be writeable):
>>>
>>> c:\random>gcc \proj1\foo.c
>>> c:\random>gcc \proj2\bar.c
>>>
>>> Here, both compilations generate a.exe. But to cap that, both end up in
>>> c:\random; the second overwrites the first, something you might be
>>> unaware of.
>>
>> Nobody cares about this in the world of building components from C.
>>
>> The build systems by and large operate from the assumption that
>> the current working directory is the top-level build directory.
>
> In fact, I should add, there is a practice of separating source
> and build directories.
>
> Any properly constructed AutoConf project supports this:
>
> $ mkdir build-dir
> $ cd build-dir
> build-dir $ /path/to/some/project/configure
>
> You create a build directory and call a configure script located
> elsewhere. It prepares that build directory for building the program.
>
>
> build-dir $ make
>
> The build references source files in /path/to/some/project.
>
> It drops object files here, inthis directory. Or some child like obj/
> depending on the exact build system.
>
> You don't want to be dropping binaries in the sae place where the
> sources are located.
>
> *THAT* location may be read-only!

The location that you invoke the compiler from may be read-only!

For example, DVD-ROM drive, if you still have one.

> Building sources that sit on a read-only mounted filesystem is a thing.

I can build and run applications in my language on a read-only device
like this:

ms prog

This runs the app from source without creating an executable file.

>
> The MIT XWindow system devised a scheme for dealing with this: the lndir
> utility.
>
> With lndir, you create a parallel tree to the target source tree,
> populated with symlinks:
>
>
> $ mkdir build-dir
> $ cd build-dir
> build-dir$ lndir /path/to/some/project .
>
> A directory structure skeleton is created mirroring that of the
> target projet, and populated with symlinks to each of its files.
>
> lndir's man page says:
>
> "This is usually useful for maintaining source code for different
> machine architectures. You create a shadow directory containing links
> to the real source, which you will have usually mounted from a
> remote machine."
>
> I was once employed producing a from-scratch embedded Linux distro,
> and doing kernel work, toolchain support and such.
>
> I religiously used separate build directories for everything I built.
> A few programs refused to cooperate. For those that couldn't be patched,
> I reached for lndir.
>
> The Linux kernel cannot (or couldn't at the time?) support separate
> build directories; I used lndir and it worked like a charm. That allowed
> me to build the same tree for x86 and MIPS without its cooperation.
>
> (The one thing that defeated lndir was that goddamed ASDF build system
> for Common Lisp. Internally, it called (truepath ...) which resolves
> all symlinks, and then it calculated object paths from the resolved
> source paths.)
>
> But anyway, if you're sitting in a different tree from where your
> source files are, you rarely want object files to be pooped into
> that tree, instead of this one here.

And yet, when you do:

gcc hello.c

it will write a.out or a.exe in the same folder.

> If you do, you're an oddball, and nobody will listen to you;
> they will say, just change to that directory and work there.

I guess I'm an oddball. I routinely modify source files and write new
EXEs in the same folder. What's the point of mucking about with a
special folder just for the one EXE file?

For a user installation, then sure, but a user installation is something
removed from a developer's directory tree.

The impression I get is that in Linux, the entire file system is
considered to be one giant developer's tree, and installed software is
part of it.

Re: bart again (UCX64)

<87o7in7yqm.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28514&group=comp.lang.c#28514

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.c
Subject: Re: bart again (UCX64)
Date: Thu, 31 Aug 2023 13:17:37 -0700
Organization: None to speak of
Lines: 32
Message-ID: <87o7in7yqm.fsf@nosuchdomain.example.com>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com>
<20230828174502.a279eb2b4ea06fac68dc6561@g{oogle}mail.com>
<e3051618-59e9-453f-a72b-14155a1c46f4n@googlegroups.com>
<uclmau$2d8p3$1@dont-email.me>
<a2f70a58-6b6e-41fd-864a-bcf947bdfdedn@googlegroups.com>
<ucn66n$2n166$1@dont-email.me>
<d500e1f2-7486-4425-a7e2-4472cce70e44n@googlegroups.com>
<ucnl64$2p8as$1@dont-email.me>
<65d28a7d-ffd5-4b8b-b3f0-2500bb05f9b7n@googlegroups.com>
<ucoe3l$2t4o2$1@dont-email.me>
<557bf807-40c7-404b-9242-c26975faa42fn@googlegroups.com>
<ucprpd$38s6i$1@dont-email.me> <ucq1gd$39q14$1@dont-email.me>
<ucq86h$3auvq$1@dont-email.me> <ucqj27$3con1$1@dont-email.me>
<ucqpgp$3dnop$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="e8d899b8fafb490ef1d8e527231431ae";
logging-data="3609987"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+swcEhHP4SOuOsVxcm222/"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:Zhj7LzgNUaDkZj6HsetCNIvQ/LQ=
sha1:IWJjYVRN5yNtsOv/0lq7VXWDK38=
 by: Keith Thompson - Thu, 31 Aug 2023 20:17 UTC

Bart <bc@freeuk.com> writes:
[...]
> If the compiler is doing multiple files, especially a slow compiler,
> then it is highly useful to know where it's up to, or what it's stuck
> on.
>
> But this seems to be a Linux thing: if I do 'cp *.c dest', then
> nothing is output, until you get the prompt back. So, did work, did it
> copy anything, was it one big file, or lots of small ones?
>
> If I do 'copy *.c test' on Windows, it shows each file copied, and it
> tells how many files were copied in all. The 'cp' command needs '-v'
> to force to show what it's doing.
>
> The defaults are backwards.
[...]

I acknowledge that you prefer tools to be verbose, and that you have
perfectly valid reasons to want a compiler to show what it's doing and
for a file copying program to print the name of each file as it's
copying it.

Please acknowledge that others have valid preferences that differ from
yours. I'm not even asking you to understand why, or to like it, just
that different valid preferences exist.

Or don't. Up to you.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Verbosity in command output (Was: bart again (UCX64))

<ucr1h9$9tnt$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=28515&group=comp.lang.c#28515

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.c
Subject: Verbosity in command output (Was: bart again (UCX64))
Date: Thu, 31 Aug 2023 21:43:05 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <ucr1h9$9tnt$1@news.xmission.com>
References: <b74c088d-09e6-4842-8b6c-1921d68154c7n@googlegroups.com> <ucqj27$3con1$1@dont-email.me> <ucqpgp$3dnop$1@dont-email.me> <87o7in7yqm.fsf@nosuchdomain.example.com>
Injection-Date: Thu, 31 Aug 2023 21:43:05 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="325373"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 31 Aug 2023 21:43 UTC

In article <87o7in7yqm.fsf@nosuchdomain.example.com>,
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
....
>I acknowledge that you prefer tools to be verbose, and that you have
>perfectly valid reasons to want a compiler to show what it's doing and
>for a file copying program to print the name of each file as it's
>copying it.
>
>Please acknowledge that others have valid preferences that differ from
>yours. I'm not even asking you to understand why, or to like it, just
>that different valid preferences exist.

Yes, but...

The problem with this form of argumentation is that it fails to acknowledge
the difference between actual constructive belief and mere defense of the
status quo.

I.e., one often (and by "often", I mean almost universally) gets the
impression that people who criticize posters like "Bart" aren't doing so
out of a genuine belief that they are right and Bart is wrong, but rather
out of general fear of change (i;e., the fear of the cognitive dissonance
that acceptance of Bart's ideas would cause them).

I get this a lot in the responses I get to my own posts.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/Noam


devel / comp.lang.c / Re: bart again (UCX64)

Pages:12345678910111213141516
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor