public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/110125] New: Variables are reported as uninitialized when only set inside WITH statement
@ 2023-06-05 12:34 admin@tho-otto.de
  2023-06-06 13:45 ` [Bug modula2/110125] " gaius at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: admin@tho-otto.de @ 2023-06-05 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110125

            Bug ID: 110125
           Summary: Variables are reported as uninitialized when only set
                    inside WITH statement
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: admin@tho-otto.de
  Target Milestone: ---

In the following fragment:

MODULE foo;

TYPE
Date = RECORD
  day: INTEGER;
END;

PROCEDURE test(): Date;
VAR d: Date;
BEGIN
  WITH d DO
    day := 0;
  END;
  RETURN d;
END test;

END foo.

When compiling with

$ gm2 -c -O2 -Wall foo.mod

i get reports about d being uninitialized:

foo.mod:9:5: warning: In procedure ‘test’: variable ‘d’ is being used but it is
never initialized in procedure ‘test’
    9 | VAR d: Date;
      |     ^

This does not happen when *not* using WITH, eg

MODULE foo;

TYPE
Date = RECORD
  day: INTEGER;
END;

PROCEDURE test(): Date;
VAR d: Date;
BEGIN
  d.day := 0;
  RETURN d;
END test;

END foo.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-30  1:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05 12:34 [Bug modula2/110125] New: Variables are reported as uninitialized when only set inside WITH statement admin@tho-otto.de
2023-06-06 13:45 ` [Bug modula2/110125] " gaius at gcc dot gnu.org
2023-06-08 12:09 ` admin@tho-otto.de
2023-06-18  1:49 ` gaius at gcc dot gnu.org
2023-07-02 20:42 ` gaius at gcc dot gnu.org
2023-07-03 10:19 ` cvs-commit at gcc dot gnu.org
2023-07-03 10:28 ` gaius at gcc dot gnu.org
2023-07-30  1:20 ` cvs-commit at gcc dot gnu.org

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).