public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type
@ 2024-02-18 14:31 simon at pushface dot org
  2024-02-19 12:17 ` [Bug ada/113979] [10/11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate ebotcazou at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: simon at pushface dot org @ 2024-02-18 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113979
           Summary: Allocation of 2D array fails when Dynamic Predicate
                    applied to type
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

Created attachment 57455
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57455&action=edit
Reproducer

This error is present in GCC 11/12/13/14 -- can’t tell about GCC 10.

The error doesn’t occur without -gnata.

--

$ /opt/gcc-14.0.1-20240114-x86_64/bin/gnatmake alloc2.adb -gnatwa -gnatl -f
-gnata
gcc -c -gnatwa -gnatl -gnata alloc2.adb

GNAT 14.0.1 20240114 (experimental)
Copyright 1992-2023, Free Software Foundation, Inc.

Compiling: alloc2.adb
Source file time stamp: 2024-02-18 14:27:29
Compiled at: 2024-02-18 14:28:05

     1. procedure Alloc2 is
     2.    type Grid is array (Positive range <>, Positive range <>) of Integer
with
     3.       Dynamic_Predicate => Grid'First (1) = 1 and then Grid'First (2) =
1;
     4.
     5.    type Grid_Ptr is access Grid;
     6.
     7.    Data : Grid_Ptr := new Grid (1 .. 10, 1 .. 20);
                              |
        >>> error: invalid use of subtype mark in expression or call

     8. begin -- Alloc2
     9.    null;
    10. end Alloc2;

 10 lines: 1 error
gnatmake: "alloc2.adb" compilation error

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

* [Bug ada/113979] [10/11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
@ 2024-02-19 12:17 ` ebotcazou at gcc dot gnu.org
  2024-02-19 12:17 ` ebotcazou at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-02-19 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-02-19
            Summary|Allocation of 2D array      |[10/11/12/13/14 regression]
                   |fails when Dynamic          |bogus error on allocator
                   |Predicate applied to type   |for type with
                   |                            |Dynamic_Predicate
     Ever confirmed|0                           |1
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Presumably something goes wrong during the expansion of the check.

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

* [Bug ada/113979] [10/11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
  2024-02-19 12:17 ` [Bug ada/113979] [10/11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate ebotcazou at gcc dot gnu.org
@ 2024-02-19 12:17 ` ebotcazou at gcc dot gnu.org
  2024-03-04 13:09 ` [Bug ada/113979] [11/12/13/14 " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-02-19 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I'll have a look.

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
  2024-02-19 12:17 ` [Bug ada/113979] [10/11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate ebotcazou at gcc dot gnu.org
  2024-02-19 12:17 ` ebotcazou at gcc dot gnu.org
@ 2024-03-04 13:09 ` rguenth at gcc dot gnu.org
  2024-03-04 13:09 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-04 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.5

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
                   ` (2 preceding siblings ...)
  2024-03-04 13:09 ` [Bug ada/113979] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-03-04 13:09 ` rguenth at gcc dot gnu.org
  2024-03-07 14:08 ` [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array " cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-04 13:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
                   ` (3 preceding siblings ...)
  2024-03-04 13:09 ` rguenth at gcc dot gnu.org
@ 2024-03-07 14:08 ` cvs-commit at gcc dot gnu.org
  2024-03-07 14:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-07 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC 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:e71a4e81729516eed8782a255ff37617e6fd4b69

commit r14-9361-ge71a4e81729516eed8782a255ff37617e6fd4b69
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Mar 7 15:05:54 2024 +0100

    Fix bogus error on allocator for array type with Dynamic_Predicate

    This is a regression present on all active branches: the compiler gives
    a bogus error on an allocator for an unconstrained array type declared
    with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
    on a subtype reference, which it cannot handle.

    This moves the check to the resulting access value (after dereference) like
    in Expand_Allocator_Expression.

    gcc/ada/
            PR ada/113979
            * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
            call Apply_Predicate_Check on the resulting access value if needed.

    gcc/testsuite/
            * gnat.dg/predicate15.adb: New test.

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
                   ` (4 preceding siblings ...)
  2024-03-07 14:08 ` [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array " cvs-commit at gcc dot gnu.org
@ 2024-03-07 14:18 ` cvs-commit at gcc dot gnu.org
  2024-03-07 14:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-07 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:0e591e6f27a20c26672ea8c0550a6ef673c1fccf

commit r13-8409-g0e591e6f27a20c26672ea8c0550a6ef673c1fccf
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Mar 7 15:05:54 2024 +0100

    Fix bogus error on allocator for array type with Dynamic_Predicate

    This is a regression present on all active branches: the compiler gives
    a bogus error on an allocator for an unconstrained array type declared
    with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
    on a subtype reference, which it cannot handle.

    This moves the check to the resulting access value (after dereference) like
    in Expand_Allocator_Expression.

    gcc/ada/
            PR ada/113979
            * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
            remove call to Apply_Predicate_Check.

    gcc/testsuite/
            * gnat.dg/predicate15.adb: New test.

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
                   ` (5 preceding siblings ...)
  2024-03-07 14:18 ` cvs-commit at gcc dot gnu.org
@ 2024-03-07 14:22 ` cvs-commit at gcc dot gnu.org
  2024-03-07 14:27 ` cvs-commit at gcc dot gnu.org
  2024-03-07 14:28 ` ebotcazou at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-07 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:f9e1d7aa8b4f0b8afff1de59fcadf1db0244b4e1

commit r12-10197-gf9e1d7aa8b4f0b8afff1de59fcadf1db0244b4e1
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Mar 7 15:05:54 2024 +0100

    Fix bogus error on allocator for array type with Dynamic_Predicate

    This is a regression present on all active branches: the compiler gives
    a bogus error on an allocator for an unconstrained array type declared
    with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
    on a subtype reference, which it cannot handle.

    This moves the check to the resulting access value (after dereference) like
    in Expand_Allocator_Expression.

    gcc/ada/
            PR ada/113979
            * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
            remove call to Apply_Predicate_Check.

    gcc/testsuite/
            * gnat.dg/predicate15.adb: New test.

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
                   ` (6 preceding siblings ...)
  2024-03-07 14:22 ` cvs-commit at gcc dot gnu.org
@ 2024-03-07 14:27 ` cvs-commit at gcc dot gnu.org
  2024-03-07 14:28 ` ebotcazou at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-07 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:b26501b6e310345ad9f6423b3f8b9df178c5e7d9

commit r11-11272-gb26501b6e310345ad9f6423b3f8b9df178c5e7d9
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Mar 7 15:05:54 2024 +0100

    Fix bogus error on allocator for array type with Dynamic_Predicate

    This is a regression present on all active branches: the compiler gives
    a bogus error on an allocator for an unconstrained array type declared
    with a Dynamic_Predicate because Apply_Predicate_Check is invoked directly
    on a subtype reference, which it cannot handle.

    This moves the check to the resulting access value (after dereference) like
    in Expand_Allocator_Expression.

    gcc/ada/
            PR ada/113979
            * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case,
            remove call to Apply_Predicate_Check.

    gcc/testsuite/
            * gnat.dg/predicate15.adb: New test.

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

* [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array type with Dynamic_Predicate
  2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
                   ` (7 preceding siblings ...)
  2024-03-07 14:27 ` cvs-commit at gcc dot gnu.org
@ 2024-03-07 14:28 ` ebotcazou at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-03-07 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Fixed on mainline and all branches.

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

end of thread, other threads:[~2024-03-07 14:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18 14:31 [Bug ada/113979] New: Allocation of 2D array fails when Dynamic Predicate applied to type simon at pushface dot org
2024-02-19 12:17 ` [Bug ada/113979] [10/11/12/13/14 regression] bogus error on allocator for type with Dynamic_Predicate ebotcazou at gcc dot gnu.org
2024-02-19 12:17 ` ebotcazou at gcc dot gnu.org
2024-03-04 13:09 ` [Bug ada/113979] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-03-04 13:09 ` rguenth at gcc dot gnu.org
2024-03-07 14:08 ` [Bug ada/113979] [11/12/13/14 regression] bogus error on allocator for array " cvs-commit at gcc dot gnu.org
2024-03-07 14:18 ` cvs-commit at gcc dot gnu.org
2024-03-07 14:22 ` cvs-commit at gcc dot gnu.org
2024-03-07 14:27 ` cvs-commit at gcc dot gnu.org
2024-03-07 14:28 ` 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).