https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110126
Thorsten Otto <ad...@tho-otto.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #14 from Thorsten Otto <ad...@tho-otto.de> --- And another problem i just encountered. In the following example: DEFINITION MODULE foo; PROCEDURE ConWS(str: ARRAY OF CHAR); END foo. IMPLEMENTATION MODULE foo; FROM SYSTEM IMPORT ADR, CARDINAL16, CARDINAL32, INTEGER16, ADDRESS, INTEGER32, WORD; FROM StrIO IMPORT WriteString, WriteLn; TYPE strtmp = ARRAY [0..255] OF CHAR; PROCEDURE str0(VAR dst: strtmp; src: ARRAY OF CHAR); VAR i, len: CARDINAL; BEGIN len := HIGH(dst); FOR i := 0 TO len DO dst[i] := src[i]; END; END str0; PROCEDURE trap_1_wl(n: INTEGER16; a: ADDRESS): [ INTEGER32 ]; VAR retvalue: INTEGER32; BEGIN ASM VOLATILE("move.l %2,-(%%sp); move.w %1,-(%%sp); trap #1; addq.l #6,%%sp; move.l %%d0,%0" : "=r"(retvalue) : "g"(n), "r"(a) : "memory" ); RETURN retvalue END trap_1_wl; PROCEDURE ConWS(str: ARRAY OF CHAR); VAR s: strtmp; BEGIN str0(s, str); trap_1_wl(9, ADR(s)); END ConWS; END foo. The call to str0 (in reality supposed to ensure the string is 0-terminated; just simplified for the example) is now completely eliminated. The assembler statement is of course only for m68k, but it can even be triggered for other targets when just producing assembler output. It does not happen when replacing the call to trap_1_wl eg. by WriteString.