public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/98230] New: Bug in Type'Modulus during a loop whose range is computed by a variable
@ 2020-12-10 18:47 adam at vany dot ca
  2020-12-10 18:49 ` [Bug ada/98230] " adam at vany dot ca
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: adam at vany dot ca @ 2020-12-10 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98230
           Summary: Bug in Type'Modulus during a loop whose range is
                    computed by a variable
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adam at vany dot ca
  Target Milestone: ---

Created attachment 49732
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49732&action=edit
Source code to reproduce

The T'Modulus of a type appears to change during a loop with a computed range.

The bug does not reproduce if the loop has a fixed range (range 1 .. 30 instead
of range 1 .. Max).  It also does not reproduce if T'Mod is not called during
the loop.


==== Output
N:  1 Modulus:     3 Mod: 1
N:  2 Modulus:     3 Mod: 2
N:  3 Modulus:     3 Mod: 3
N:  4 Modulus:     3 Mod: 4
N:  5 Modulus:     3 Mod: 5
N:  6 Modulus:     3 Mod: 6
N:  7 Modulus:     3 Mod: 7
N:  8 Modulus:     3 Mod: 8
N:  9 Modulus:     3 Mod: 9
N:  10 Modulus:    03 Mod: 10
N:  11 Modulus:    13 Mod: 11
N:  12 Modulus:    23 Mod: 12
N:  13 Modulus:    33 Mod: 13
N:  14 Modulus:    43 Mod: 14
N:  15 Modulus:    53 Mod: 15
N:  16 Modulus:    63 Mod: 16
N:  17 Modulus:    73 Mod: 17
N:  18 Modulus:    83 Mod: 18
N:  19 Modulus:    93 Mod: 19
N:  20 Modulus:    03 Mod: 20
N:  21 Modulus:    13 Mod: 21
N:  22 Modulus:    23 Mod: 22
N:  23 Modulus:    33 Mod: 23
N:  24 Modulus:    43 Mod: 24
N:  25 Modulus:    53 Mod: 25
N:  26 Modulus:    63 Mod: 26
N:  27 Modulus:    73 Mod: 27
N:  28 Modulus:    83 Mod: 28
N:  29 Modulus:    93 Mod: 29
N:  30 Modulus:    03 Mod: 30

=== Expected output
Modulus should not change, it should always be 3, Mod: should always stay in
the range 0-3.

If the loop is change to 1 .. 30, instead of 1 .. Max, it works as expected.

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

end of thread, other threads:[~2020-12-10 21:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 18:47 [Bug ada/98230] New: Bug in Type'Modulus during a loop whose range is computed by a variable adam at vany dot ca
2020-12-10 18:49 ` [Bug ada/98230] " adam at vany dot ca
2020-12-10 20:17 ` ebotcazou at gcc dot gnu.org
2020-12-10 20:18 ` ebotcazou at gcc dot gnu.org
2020-12-10 20:31 ` [Bug ada/98230] incorrect Type'Mod " ebotcazou at gcc dot gnu.org
2020-12-10 21:30 ` cvs-commit at gcc dot gnu.org
2020-12-10 21:31 ` cvs-commit at gcc dot gnu.org
2020-12-10 21:31 ` cvs-commit at gcc dot gnu.org
2020-12-10 21:32 ` cvs-commit at gcc dot gnu.org
2020-12-10 21:33 ` ebotcazou at gcc dot gnu.org
2020-12-10 21:35 ` adam at vany dot ca

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