]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR modula2/120497: error is generated for good code when returning a pointer var...
authorGaius Mulley <gaiusmod2@gmail.com>
Sun, 1 Jun 2025 00:05:55 +0000 (01:05 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sun, 1 Jun 2025 00:05:55 +0000 (01:05 +0100)
commit170717fa243ef466a99498113167627539af4553
tree9ee5e02c7d50a23a4f38c5b23019098cccb53ef0
parent9739ae9384dd7cd3bb1c7683d6b80b7a9116eaf8
PR modula2/120497: error is generated for good code when returning a pointer var variable

The return type checking needs to skip over the Lvalue part of the VAR
parameter or variable.

gcc/m2/ChangeLog:

PR modula2/120497
* gm2-compiler/M2Range.mod (IsAssignmentCompatible): Remove from
import list.
(FoldTypeReturnFunc): Rewrite to skip the Lvalue of a var
variable.
(CodeTypeReturnFunc): Ditto.
(CodeTypeIndrX): Call AssignmentTypeCompatible rather than
IsAssignmentCompatible.
(FoldTypeIndrX): Ditto.

gcc/testsuite/ChangeLog:

PR modula2/120497
* gm2/pim/pass/ReturnType.mod: New test.
* gm2/pim/pass/ReturnType2.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/M2Range.mod
gcc/testsuite/gm2/pim/pass/ReturnType.mod [new file with mode: 0644]
gcc/testsuite/gm2/pim/pass/ReturnType2.mod [new file with mode: 0644]