Beginner contribution question regarding HAS_ROWS / low_dup cleanup

Jose E. Marchesi jemarch@gnu.org
Sat Jun 13 11:39:48 GMT 2026


> Hello everyone,
>
> My name is Kanishka, and I am a second year Computer Science student
> interested in compilers and low level development. I just joined the
> AlgoI68 mailing list and I would like to start contributing to the
> frontend as a beginner to GCC/open source development.

Welcome!

> I was going through the Algo68 big task list and noticed the following
> issue:
> “It is no longer necessary to check for HAS_ROWS before calling low_dup.
> Remove existing checks from the codebase.”
> I was thinking of trying to work on this as a first contribution. Before
> starting, I wanted to ask whether this would be a reasonable beginner issue
> and whether anyone is already working on it.
> If there are better beginner friendly issues or any recommended starting
> points, I would greatly appreciate any guidance.

Yeah, I think that would be a good place where to start, because it
doesn't require knowing much (but some) about GCC internals, nor about
Algol 68 :)

a68_low_dup is a function that, given an expression, builds and returns
a tree with all the operations required to get a deep copy of the given
expression.  It is used, for example, to copy Algol 68 values around.

The internal works of a68_low_dup are not really relevant for this task,
save for one aspect of it: when originally written, a68_low_dup would
always make a deep copy.  Algol 68 values that require a deep copy when
copied are those that "have rows" in them.  So, initially, it was good
to check for HAS_ROWS on the mode of the expression being passed (this
is MOID (expr)) to avoid generating an expensive deep copy that is not
really needed.

At some point a68_low_dup got rewritten/improved and as part of this it
started checking whether the given expression has rows.  In case it
doesn't have rows, it does nothing:


  a68_low_dup
  {
    if (A68_ROW_TYPE_P (type))
      {
        ...
      }
    else if (!HAS_ROWS (m))
      {
        dup = expr;
      }
    else if (A68_STRUCT_TYPE_P (type))
      {
        ...
      }
    other cases...

    return dup;
  }

So the task is to survey every call to a68_low_dup and to remove the
caller side checks for HAS_ROWS, since these are no longer necessary and
a68_low_dup can be called unconditionally (conceptually a dup is always
performed).

a68_low_dup is defined in a68-low.cc.  Most of GNU software (including
GCC) follow the GNU Coding Standard, and that means that you can always
easily find where a function is defined by grepping by "^FUNCTIONAME ",
i.e.:

  $ egrep "^a68_low_dup " *.cc
  a68-low.cc:a68_low_dup (tree expr, bool use_heap)

First think you will need to do is to clone the git master GCC, build it
specifying algol68 in --enable-languages, and then run the Algol 68
testsuite with:

  $ make -jN check-algol68

You will find detailed instructions for building, testing, etc in the
gcc/algol68/README file.  Please take a look (if you haven't done
already).

Patches in RFC (request for comments) status are to be sent to this
list, algol68@gcc.gnu.org.

Patches for review are to be sent to gcc-patches@gcc.gnu.org with CC to
this list algol68@gcc.gnu.org.

The IRC, I see you are already in #gnualgol.

Finally, how is your Algol 68? :) There are links to downloadable books
and other learning resources at https://algol68-lang.org.  I would
recommend the Informal Introduction from Charles Lindsey and van der
Meulen.  It is a very good book (note that "informal" in this context
doesn't mean it just covers a subset of the language, it teaches the
language in full, only not formally like the Revised Report does).

And I think that is all...
Again, welcome!


More information about the Algol68 mailing list