]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/109952 Inconsistent HIGH values with 'ARRAY OF CHAR'
authorGaius Mulley <gaiusmod2@gmail.com>
Wed, 24 May 2023 10:14:07 +0000 (11:14 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Wed, 24 May 2023 10:14:07 +0000 (11:14 +0100)
commitb4df098647b687ca4e43952ec4a198b2816732ba
treea52492a7250d9322ff899b47a38d545036940333
parentee2a8b373a88bae4c533aa68bed56bf01afea0e2
PR modula2/109952 Inconsistent HIGH values with 'ARRAY OF CHAR'

This patch fixes the case when a single character constant literal is
passed as a string actual parameter to an ARRAY OF CHAR formal parameter.
To be consistent a single character is promoted to a string and nul
terminated (and its high value is 1).  Previously a single character
string would not be nul terminated and the high value was 0.
The documentation now includes a section describing the expected behavior
and included in this patch is some regression test code matching the
table inside the documentation.

gcc/ChangeLog:

PR modula2/109952
* doc/gm2.texi (High procedure function): New node.
(Using): New menu entry for High procedure function.

gcc/m2/ChangeLog:

PR modula2/109952
* Make-maintainer.in: Change header to include emacs file mode.
* gm2-compiler/M2GenGCC.mod (BuildHighFromChar): Check whether
operand is a constant string and is nul terminated then return one.
* gm2-compiler/PCSymBuild.mod (WalkFunction): Add default return
TRUE.  Static analysis missing return path fix.
* gm2-libs/IO.mod (Init): Rewrite to help static analysis.
* target-independent/m2/gm2-libs.texi: Rebuild.

gcc/testsuite/ChangeLog:

PR modula2/109952
* gm2/pim/run/pass/hightests.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/doc/gm2.texi
gcc/m2/Make-maintainer.in
gcc/m2/gm2-compiler/M2GenGCC.mod
gcc/m2/gm2-compiler/PCSymBuild.mod
gcc/m2/gm2-libs/IO.mod
gcc/m2/target-independent/m2/gm2-libs.texi
gcc/testsuite/gm2/pim/run/pass/hightests.mod [new file with mode: 0644]