public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug.
@ 2021-02-14  8:47 rodakay5 at gmail dot com
  2021-03-02  0:48 ` [Bug ada/99095] [10/11 regression] couple of issues with unconstrained array of limited record ebotcazou at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rodakay5 at gmail dot com @ 2021-02-14  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99095
           Summary: Unconstrained array of limited records results in a
                    bounds bug.
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rodakay5 at gmail dot com
  Target Milestone: ---

Created attachment 50181
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50181&action=edit
Contains 2 minimal test procedures.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)



$ gnatmake -vh test_bug_box.adb 

GNATMAKE 10.2.0
Copyright (C) 1992-2020, Free Software Foundation, Inc.
  "test_bug_box.ali" being checked ...
  -> "test_bug_box.ali" missing.
gcc -c test_bug_box.adb
+===========================GNAT BUG DETECTED==============================+
| 10.2.0 (x86_64-pc-linux-gnu) Storage_Error stack overflow or erroneous memory
access|
| Error detected at test_bug_box.adb:16:4                                  |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

test_bug_box.adb

compilation abandoned
End of compilation
gnatmake: "test_bug_box.adb" compilation error



The attached file contains 2 test procedures ...


'Test_Bug_Box' contains code which results in a gnat bug box.
The procedure itself prints out no output.


'Test_Buggy_Bounds' builds without a bug box.
The expected output is ...

a) First => 1
a) Last  => 2
b) First => 1
b) Last  => 2

The actual output is ...

a) First => 1
a) Last  =>-1171747055
b) First => 1326201608
b) Last  => 32767

The 'a) First' value is always 1.
The others values are random. 


The code contains some commented out lines which I hope are helpful.

The problem appears to have been introduced in 'GCC version 10.1.0'.
The problem does not occur in GCC 9.3.0 or lower.

A (naive) guess might be that the secondary stack pointer becomes corrupted or
is wrongly positioned.


Regards.

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

* [Bug ada/99095] [10/11 regression] couple of issues with unconstrained array of limited record
  2021-02-14  8:47 [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug rodakay5 at gmail dot com
@ 2021-03-02  0:48 ` ebotcazou at gcc dot gnu.org
  2021-03-02  9:26 ` ebotcazou at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-03-02  0:48 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
   Last reconfirmed|                            |2021-03-02
             Status|UNCONFIRMED                 |NEW
            Summary|Unconstrained array of      |[10/11 regression] couple
                   |limited records results in  |of issues with
                   |a bounds bug.               |unconstrained array of
                   |                            |limited record
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I can reproduce.

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

* [Bug ada/99095] [10/11 regression] couple of issues with unconstrained array of limited record
  2021-02-14  8:47 [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug rodakay5 at gmail dot com
  2021-03-02  0:48 ` [Bug ada/99095] [10/11 regression] couple of issues with unconstrained array of limited record ebotcazou at gcc dot gnu.org
@ 2021-03-02  9:26 ` ebotcazou at gcc dot gnu.org
  2021-03-02 17:00 ` [Bug ada/99095] [10/11 regression] issue with function returning " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-03-02  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

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
                 CC|ebotcazou at gcc dot gnu.org       |
             Status|NEW                         |ASSIGNED

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixing.

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

* [Bug ada/99095] [10/11 regression] issue with function returning unconstrained array of limited record
  2021-02-14  8:47 [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug rodakay5 at gmail dot com
  2021-03-02  0:48 ` [Bug ada/99095] [10/11 regression] couple of issues with unconstrained array of limited record ebotcazou at gcc dot gnu.org
  2021-03-02  9:26 ` ebotcazou at gcc dot gnu.org
@ 2021-03-02 17:00 ` cvs-commit at gcc dot gnu.org
  2021-03-02 17:01 ` cvs-commit at gcc dot gnu.org
  2021-03-02 17:02 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-02 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:168b75ff54b4e70650b8709816edff13f93e737a

commit r11-7456-g168b75ff54b4e70650b8709816edff13f93e737a
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Mar 2 17:58:46 2021 +0100

    Fix PR ada/99095

    This is a regression present on the mainline and 10 branch, where we fail
    to make the bounds explicit for the return value of a function returning
    an unconstrained array of a limited record type.

    gcc/ada/
            PR ada/99095
            * sem_ch8.adb (Check_Constrained_Object): Restrict again the
special
            optimization for limited types to non-array types except in the
case
            of an extended return statement.
    gcc/testsuite/
            * gnat.dg/limited5.adb: New test.

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

* [Bug ada/99095] [10/11 regression] issue with function returning unconstrained array of limited record
  2021-02-14  8:47 [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug rodakay5 at gmail dot com
                   ` (2 preceding siblings ...)
  2021-03-02 17:00 ` [Bug ada/99095] [10/11 regression] issue with function returning " cvs-commit at gcc dot gnu.org
@ 2021-03-02 17:01 ` cvs-commit at gcc dot gnu.org
  2021-03-02 17:02 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-02 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:7297af89ea22c1a1da8609d811e100cf73e574d6

commit r10-9402-g7297af89ea22c1a1da8609d811e100cf73e574d6
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Mar 2 17:58:46 2021 +0100

    Fix PR ada/99095

    This is a regression present on the mainline and 10 branch, where we fail
    to make the bounds explicit for the return value of a function returning
    an unconstrained array of a limited record type.

    gcc/ada/
            PR ada/99095
            * sem_ch8.adb (Check_Constrained_Object): Restrict again the
special
            optimization for limited types to non-array types except in the
case
            of an extended return statement.
    gcc/testsuite/
            * gnat.dg/limited5.adb: New test.

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

* [Bug ada/99095] [10/11 regression] issue with function returning unconstrained array of limited record
  2021-02-14  8:47 [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug rodakay5 at gmail dot com
                   ` (3 preceding siblings ...)
  2021-03-02 17:01 ` cvs-commit at gcc dot gnu.org
@ 2021-03-02 17:02 ` ebotcazou at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-03-02 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Thanks for reporting the problem.

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

end of thread, other threads:[~2021-03-02 17:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14  8:47 [Bug ada/99095] New: Unconstrained array of limited records results in a bounds bug rodakay5 at gmail dot com
2021-03-02  0:48 ` [Bug ada/99095] [10/11 regression] couple of issues with unconstrained array of limited record ebotcazou at gcc dot gnu.org
2021-03-02  9:26 ` ebotcazou at gcc dot gnu.org
2021-03-02 17:00 ` [Bug ada/99095] [10/11 regression] issue with function returning " cvs-commit at gcc dot gnu.org
2021-03-02 17:01 ` cvs-commit at gcc dot gnu.org
2021-03-02 17:02 ` ebotcazou 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).