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
* [Bug ada/98230] Bug in Type'Modulus during a loop whose range is computed by a variable
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 ` adam at vany dot ca
2020-12-10 20:17 ` ebotcazou at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: adam at vany dot ca @ 2020-12-10 18:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
--- Comment #1 from Adam Van Ymeren <adam at vany dot ca> ---
Forgot some details
=== output of gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6'
--with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-8
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] Bug in Type'Modulus during a loop whose range is computed by a variable
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
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2020-12-10 20:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-12-10
Ever confirmed|0 |1
CC| |ebotcazou at gcc dot gnu.org
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Rather curious indeed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] Bug in Type'Modulus during a loop whose range is computed by a variable
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
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2020-12-10 20:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ebotcazou at gcc dot gnu.org
--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Investigating.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (2 preceding siblings ...)
2020-12-10 20:18 ` ebotcazou at gcc dot gnu.org
@ 2020-12-10 20:31 ` ebotcazou at gcc dot gnu.org
2020-12-10 21:30 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2020-12-10 20:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.5
Summary|Incorrect Type'Mod during a |incorrect Type'Mod during a
|loop whose range is |loop whose range is
|computed by a variable |computed by a variable
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (3 preceding siblings ...)
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
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-10 21:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eric Botcazou <ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:779bf1823ced0814803d2be7f7ded0317e70140c
commit r11-5920-g779bf1823ced0814803d2be7f7ded0317e70140c
Author: Ed Schonberg <schonberg@adacore.com>
Date: Thu Dec 10 22:26:57 2020 +0100
Fix PR ada/98230
It's a rather curious malfunction of the 'Mod attribute applied to the
variable of a loop whose upper bound is dynamic.
gcc/ada/ChangeLog:
PR ada/98230
* exp_attr.adb (Expand_N_Attribute_Reference, case Mod): Use base
type of argument to obtain static bound and required size.
gcc/testsuite/ChangeLog:
* gnat.dg/modular6.adb: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (4 preceding siblings ...)
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
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-10 21:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:bc7d2977d108ed00c30c9f21d5701f28ffb50f29
commit r10-9137-gbc7d2977d108ed00c30c9f21d5701f28ffb50f29
Author: Ed Schonberg <schonberg@adacore.com>
Date: Thu Dec 10 22:26:57 2020 +0100
Fix PR ada/98230
It's a rather curious malfunction of the 'Mod attribute applied to the
variable of a loop whose upper bound is dynamic.
gcc/ada/ChangeLog:
PR ada/98230
* exp_attr.adb (Expand_N_Attribute_Reference, case Mod): Use base
type of argument to obtain static bound and required size.
gcc/testsuite/ChangeLog:
* gnat.dg/modular6.adb: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (5 preceding siblings ...)
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
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-10 21:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:da6e672dc9bbedb993a5fea498954f0ca861b7ec
commit r9-9107-gda6e672dc9bbedb993a5fea498954f0ca861b7ec
Author: Ed Schonberg <schonberg@adacore.com>
Date: Thu Dec 10 22:26:57 2020 +0100
Fix PR ada/98230
It's a rather curious malfunction of the 'Mod attribute applied to the
variable of a loop whose upper bound is dynamic.
gcc/ada/ChangeLog:
PR ada/98230
* exp_attr.adb (Expand_N_Attribute_Reference, case Mod): Use base
type of argument to obtain static bound and required size.
gcc/testsuite/ChangeLog:
* gnat.dg/modular6.adb: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (6 preceding siblings ...)
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
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-10 21:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:
https://gcc.gnu.org/g:87c40733898283f0d1e48bcbf8055c2718064e77
commit r8-10673-g87c40733898283f0d1e48bcbf8055c2718064e77
Author: Ed Schonberg <schonberg@adacore.com>
Date: Thu Dec 10 22:26:57 2020 +0100
Fix PR ada/98230
It's a rather curious malfunction of the 'Mod attribute applied to the
variable of a loop whose upper bound is dynamic.
gcc/ada/ChangeLog:
PR ada/98230
* exp_attr.adb (Expand_N_Attribute_Reference, case Mod): Use base
type of argument to obtain static bound and required size.
gcc/testsuite/ChangeLog:
* gnat.dg/modular6.adb: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (7 preceding siblings ...)
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
9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2020-12-10 21:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixed on all branches.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug ada/98230] incorrect Type'Mod during a loop whose range is computed by a variable
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
` (8 preceding siblings ...)
2020-12-10 21:33 ` ebotcazou at gcc dot gnu.org
@ 2020-12-10 21:35 ` adam at vany dot ca
9 siblings, 0 replies; 11+ messages in thread
From: adam at vany dot ca @ 2020-12-10 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98230
--- Comment #9 from Adam Van Ymeren <adam at vany dot ca> ---
Awesome thanks!
^ 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).