EEVblog Electronics Community Forum

Products => Computers => Programming => Topic started by: SiliconWizard on April 29, 2023, 01:07:30 am

Title: GCC 13.1 is out
Post by: SiliconWizard on April 29, 2023, 01:07:30 am
So I tried building it.

I was kind of "looking forward" (well, that's probably too strong a word ;D ) to testing the Modula-2 front-end, but it fails to build on my platform.
The culprit is there, in gcc/m2/mc-boot/GDynamicStrings.cc :
Code: [Select]
static void writeAddress (void * a)
{
  writeLongcard ((long unsigned int ) (a));
}

Nice one, isn't it? ;D
Title: Re: GCC 13.1 is out
Post by: brucehoult on April 29, 2023, 02:41:39 am
I saw the Modula 2 announcement. 40 years later....

Kind of interesting, but it's just a stepping stone on the way to Modula-3 on the one hand and Oberon on the other.

As for the error ... I guess assuming long is the same size as a pointer is almost as bad as assuming int is. uintptr_t, anyone?

Hmm ... IL32LLP64 or IP16L32 ?  I don't think anyone has made an IP32L64 platform.

Win64 seems more likely than PDP-11 :-)
Title: Re: GCC 13.1 is out
Post by: SiliconWizard on April 29, 2023, 02:59:37 am
I'm just guessing this piece of code may have been pretty old, probably pre-C99, and was never refactored. It's unfortunate that it made it to GCC mainline, but oh well. I opened a ticket on bugzilla.

The Modula-2 front-end is GNU Modula-2 that got finally included as an official front-end. It has been a relatively active development for years.

Modula-3 is under "active" development as well, but given the very limited success it had, it probably will never make it to GCC. The fact gm2 was a GNU project probably helped a bit, here.
https://github.com/modula3/cm3

Many people may not know that Modula-2 has been used extensively in some areas, for instance in the russian aerospace industry. Current GLONASS satellites run on Modula-2 code, for instance. Not unlikely that there may be Modula-2 code in the Soyuz spacecrafts and rockets.
Title: Re: GCC 13.1 is out
Post by: SiliconWizard on April 29, 2023, 03:36:42 am
I thought I would have logically had more luck building it for arm32. Indeed this one above doesn't pose a problem here, but I ran into another compile error, in gm2 libs this time.
Oh well. Maybe they rushed it a little bit.
Title: Re: GCC 13.1 is out
Post by: eutectique on April 30, 2023, 06:05:06 pm
Many people may not know that Modula-2 has been used extensively in some areas, for instance in the russian aerospace industry. Current GLONASS satellites run on Modula-2 code, for instance. Not unlikely that there may be Modula-2 code in the Soyuz spacecrafts and rockets.

Modula-2 was popular at one of the Soviet nuclear facilities. It was running on "Electronica 60" (LSI-11 clone) controlling ion mass spectrometers. Software development was done on SM-1420, clone of PDP-11/45.
Title: Re: GCC 13.1 is out
Post by: DiTBho on April 30, 2023, 08:39:11 pm
yeah, it's frustrating, I know, and trying to integrate ADA-core is even more frustrating, especially on non-x86 machines.
damn, compiling my-c (even from gcc) is much faster and easier than compiling gcc from itself.

Plus, if gcc-v12 has a catastrophic end on my mips tiny router (because it eats too much memory and provides ZERO clues), gcc-v13 is even worse

When you see all of these "difficulties" with a compiler, when you see it take 20 years to "add" a valid language and still it has integration problems, well it's when you feel that there must be something wrong in computer science.

Title: Re: GCC 13.1 is out
Post by: SiliconWizard on May 01, 2023, 02:46:49 am
When you see all of these "difficulties" with a compiler, when you see it take 20 years to "add" a valid language and still it has integration problems, well it's when you feel that there must be something wrong in computer science.

There is something "wrong", but I don't know if we can blame "computer science" per se. All this is just the result of software systems being very complex really quick, and no amount of silver bullets (and there have been many over the last decades) have really been able to mitigate this.

But I'm 100% in favor of simpler, in-house tools just like you did, when it's possible. It lowers the overall complexity of your projects dramatically (even if there's a steep curve in the beginning to develop said tools.)

Something as complex, multi-target and multi-platform as GCC, with a relatively old architecture now (so probably not *initially* designed to become this versatile) is very difficult to maintain, and it's already almost a miracle that it support this many environments, even if building it is sometimes challenging (to impossible.)

Regarding GCC 13 in particular, I've tried building it for different targets and different hosts and got issues in almost all cases. Hadn't run into this with GCC for years. This one version seems to have the most changes GCC had in a long time.
Title: Re: GCC 13.1 is out
Post by: DiTBho on May 01, 2023, 10:44:02 am
building it for different targets and different hosts

Code: [Select]
.
 [1] aarch64-unknown-linux-gnu-6.5.0
 [2] aarch64-unknown-linux-gnu-9.3.0 *

 [3] armv5tel-softfloat-linux-gnueabi-6.5.0 *
 [4] armv5tel-softfloat-linux-gnueabi-9.3.0

 [5] armv7a-unknown-linux-gnueabihf-6.5.0
 [6] armv7a-unknown-linux-gnueabihf-8.4.0
 [7] armv7a-unknown-linux-gnueabihf-9.3.0 *

 [8] hppa-unknown-linux-gnu-6.5.0
 [9] hppa-unknown-linux-gnu-9.3.0 *

 [10] hppa64-unknown-linux-gnu-6.5.0
 [11] hppa64-unknown-linux-gnu-9.3.0 *

 [12] i686-pc-linux-gnu-4.9.4-gnat2016
 [13] i686-pc-linux-gnu-6.5.0
 [14] i686-pc-linux-gnu-7.3.1-gnat2018
 [15] i686-pc-linux-gnu-7.5.0
 [16] i686-pc-linux-gnu-8.3.1-gnat2019
 [17] i686-pc-linux-gnu-8.4.0
 [18] i686-pc-linux-gnu-9.3.0 *
 [19] i686-pc-linux-gnu-10.2.0

 [20] mips-unknown-linux-gnu-4.1.2-legacy
 [21] mips-unknown-linux-gnu-4.5.3-legacy
 [22] mips-unknown-linux-gnu-6.5.0
 [23] mips-unknown-linux-gnu-9.3.0 *

 [24] mips64-unknown-linux-gnu-6.5.0
 [25] mips64-unknown-linux-gnu-9.3.0 *

 [26] mipsel-unknown-linux-gnu-4.5.3-legacy
 [27] mipsel-unknown-linux-gnu-6.5.0
 [28] mipsel-unknown-linux-gnu-9.3.0 *


 [29] powerpc-unknown-linux-gnu-6.5.0
 [30] powerpc-unknown-linux-gnu-9.3.0 *

 [31] powerpc64-unknown-linux-gnu-9.3.0 *

 [32] sparc64-unknown-linux-gnu-6.5.0 *
 [33] sparc64-unknown-linux-gnu-9.3.0

 [34] x86_64-pc-linux-gnu-10.2.0 *
 [35] x86_64-pc-linux-gnu-12.0.0 *

v12 and v13 fail on Catalyst and/or don't correctly work (see my topic about Gcc-v12 on mipsel ... still unsolved), so this is currently my working environment for production, and there are tons of patches applied, some are architecture-{ target, host }-specific.

Since gcc >=v4.1.2, I haven't seen the situation improve, but on the contrary, I see things getting messed up at every new release.

OK, here's a Gentoo problem with ebuilds, eclasses and EAPIs, and policies (e.g. we don't want language+=ada, nor do we want language+=modula2, only language=c, c++, fortran) ...

... but hey? the sys-devel/gcc-* ebuilds

cross-compiling gcc is ... frustrating (indeed I native compile it under QEMU/$arch)
adapting gcc is ... frustrating (indeed I savagely hack it)

getting your hands on it to simply move working directories or add functions is ... frustrating, and the gcc C code itself is written so bad that trying to analyze the project with Stood or AAL ... is impossible as the tool explode in thousand error messages.

This is *very* frustrating on Catalyst as never know if it will fail or succeed, everything is always very random, and it's always so fail-prone that costs a lot of human power to maintain.

On the top of it, I think this reflects how badly structure gcc is as a project.

         GNU Gcc ---> gcc
     new GNU Gcc ---> ngcc

They would have to re-engineer it and rewrite it from scratch, at least ... in the form of a parallel branch.

Title: Re: GCC 13.1 is out
Post by: cfbsoftware on May 06, 2023, 03:25:11 am
Many people may not know that Modula-2 has been used extensively in some areas, for instance in the russian aerospace industry.

Modula-2 was also used successfully for chip design.

Read the chapter "The Chip Company that made $100M with MODULA-2" in the book The School of Niklaus Wirth, "The Art of Simplicity", László Böszörményi, Jürg Gutknecht, Gustav Pomberger (Eds.):  Morgan-Kaufmann 2000, ISBN 3-932588-85-1
Quote
In 1981 the Philips/Signetics design group in Orem, Utah learned about Modula-2 and the Lilith computer. Within two  years, 25 chip designers each had a Lilith computer to do schematic capture, device modeling, and circuit simulation.  All the programming had been done by two student  programmers. The programs were ecstatically reviewed by a team of outside consultants hired by Philips to review all the available CAD software. The Orem operation became extremely profitable, and every type of CAD and system software was written in Modula-2 by a small and chang­ing group of student programmers.
Google books has a preview of all the pages, except one, of this chapter:

https://books.google.com.au/books?id=6kHs4s-79bkC&pg=PA219


Title: Re: GCC 13.1 is out
Post by: brucehoult on May 06, 2023, 03:55:51 am
That's very cool, but the early 1980s were a loooong time ago in the chip-making world.

In 1984 as a grad student at Waikato university I worked on a project to make compilers for a number of languages (some developed by students for their thesis e.g. "Peano" by Lawrence D'Oliviero) and back-ends for various machines including VAX and Z8000, all using a common intermediate language. Everything was written in Modula-2.  I don't recall now whether we modified Modula's M-code as the intermediate language, or made a completely custom one. We certainly *talked* a lot about a design for our own intermediate language. M-code didn't have sufficient features for some of the languages we wanted to implement.
Title: Re: GCC 13.1 is out
Post by: DiTBho on May 06, 2023, 10:00:53 am
Z8000

let's imagine that with 8086 intel went bankrupt, what if Intel x86 never existed and our PCs evolved on z8k?

Modula2 on Z8K = Sweet Dream
Sweet Dreams are made of this.

Title: Re: GCC 13.1 is out
Post by: cfbsoftware on May 06, 2023, 11:05:04 am
Modula2 on Z8K = Sweet Dream
Sweet Dreams are made of this.
Not just a dream - even in 1990:

https://compilers.iecc.com/comparch/article/90-08-059
Title: Re: GCC 13.1 is out
Post by: brucehoult on May 06, 2023, 11:49:31 am
Z8000

let's imagine that with 8086 intel went bankrupt, what if Intel x86 never existed and our PCs evolved on z8k?

Z8000 avoids some of the more ugly parts of the 8086, but it shares its problems of being essentially a 16 bit machine, with the most efficient arithmetic being on 16 bit quantities and a 64k address space plus segments.

It is better than 8086 in at least having sixteen general purpose 16 bit registers vs eight weirdly specialised ones for the 8086.

But the Motorola 68000 came only six months later with sixteen full 32 bit registers, and a natively 32 bit ISA including 32 bit pointers and address arithmetic (the first chip only brought out 24 address lines, of course. The 68020 brought out a full 32 bit address bus). It was also twice as fast.
Title: Re: GCC 13.1 is out
Post by: SiliconWizard on May 07, 2023, 08:25:02 pm
Just to let you know that the issue got taken care of pretty quickly after I submitted the report. So that should be fixed in the next release. (I didn't get to check the patch yet.)
Title: Re: GCC 13.1 is out
Post by: SiliconWizard on May 07, 2023, 08:28:02 pm
Many people may not know that Modula-2 has been used extensively in some areas, for instance in the russian aerospace industry.

Modula-2 was also used successfully for chip design.

Much later on (1995), Wirth came up with Lola (and then Lola-2), some HDL based on his programming languages (Pascal/Modula/...)