public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "admin@tho-otto.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/110126] Variables are reported as unused when only referenced by ASM statements Date: Tue, 11 Jul 2023 18:13:19 +0000 [thread overview] Message-ID: <bug-110126-4-L51Khv4tOo@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110126-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110126 Thorsten Otto <admin@tho-otto.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #14 from Thorsten Otto <admin@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.
next prev parent reply other threads:[~2023-07-11 18:13 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-05 12:45 [Bug modula2/110126] New: " admin@tho-otto.de 2023-06-06 14:26 ` [Bug modula2/110126] " gaius at gcc dot gnu.org 2023-06-07 5:06 ` admin@tho-otto.de 2023-06-07 12:50 ` gaius at gcc dot gnu.org 2023-06-08 20:33 ` gaius at gcc dot gnu.org 2023-06-08 23:56 ` cvs-commit at gcc dot gnu.org 2023-06-08 23:56 ` gaius at gcc dot gnu.org 2023-06-09 6:21 ` admin@tho-otto.de 2023-06-09 7:19 ` admin@tho-otto.de 2023-06-12 12:26 ` gaius at gcc dot gnu.org 2023-06-12 13:35 ` admin@tho-otto.de 2023-06-12 14:26 ` cvs-commit at gcc dot gnu.org 2023-06-12 14:28 ` gaius at gcc dot gnu.org 2023-06-13 11:36 ` admin@tho-otto.de 2023-07-11 18:13 ` admin@tho-otto.de [this message] 2023-07-29 16:25 ` cvs-commit at gcc dot gnu.org 2023-07-29 20:04 ` cvs-commit at gcc dot gnu.org 2023-07-29 20:13 ` gaius at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110126-4-L51Khv4tOo@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).