public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/106037] New: ICE with Aggregate aspect
@ 2022-06-20 22:38 jesper.quorning at gmail dot com
  2022-07-01 11:07 ` [Bug ada/106037] " ebotcazou at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jesper.quorning at gmail dot com @ 2022-06-20 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106037
           Summary: ICE with Aggregate aspect
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jesper.quorning at gmail dot com
  Target Milestone: ---

Created attachment 53174
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53174&action=edit
Source from Description

This causes ICE with 12.1.0:

procedure Container_Aggregates is

   type Array_Type is
     array (1 .. 10) of Integer
   with Aggregate => (Empty => Empty_Array);

   Empty_Array : constant Array_Type := [1..10 => 123];

begin
   null;
end Container_Aggregates;

ICE:

% gnatmake -gnat2022 container_aggregates.adb
gcc -c -gnat2022 container_aggregates.adb
+===========================GNAT BUG DETECTED==============================+
| 12.1.0 (x86_64-apple-darwin15) Program_Error sem_type.adb:837 explicit raise|
| Error detected at container_aggregates.adb:7:43                          |
| Compiling container_aggregates.adb                                       |
| 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.                                       |
+==========================================================================+

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

* [Bug ada/106037] ICE with Aggregate aspect
  2022-06-20 22:38 [Bug ada/106037] New: ICE with Aggregate aspect jesper.quorning at gmail dot com
@ 2022-07-01 11:07 ` ebotcazou at gcc dot gnu.org
  2022-07-02 16:16 ` p.p11 at orange dot fr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2022-07-01 11:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-07-01
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
On mainline:

+===========================GNAT BUG DETECTED==============================+
| 13.0.0 20220701 (experimental) [master bb6325c8ad2] (x86_64-suse-linux)  |
| Assert_Failure failed precondition from sinfo-nodes.ads:3970

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

* [Bug ada/106037] ICE with Aggregate aspect
  2022-06-20 22:38 [Bug ada/106037] New: ICE with Aggregate aspect jesper.quorning at gmail dot com
  2022-07-01 11:07 ` [Bug ada/106037] " ebotcazou at gcc dot gnu.org
@ 2022-07-02 16:16 ` p.p11 at orange dot fr
  2024-03-13 15:11 ` simon at pushface dot org
  2024-03-13 15:40 ` [Bug ada/106037] internal error with Aggregate aspect on array type ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: p.p11 at orange dot fr @ 2022-07-02 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

Pascal Pignard <p.p11 at orange dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.p11 at orange dot fr

--- Comment #2 from Pascal Pignard <p.p11 at orange dot fr> ---
Same error with iterated element association in aggregate:

597.          declare
598.             Keys : constant array (Positive range <>) of Integer := [2, 3,
5, 7, 11];
599.          begin
600. 
601.             --  A map aggregate where the values produced by the
602.             --  iterated_element_association are of the same type as the
key
603.             --  (eliminating the need for a separate key_expression):
604. 
605.                M := [for Key1 of Keys => Integer'Image (Key1)];

+===========================GNAT BUG DETECTED==============================+
| 12.1.0 (x86_64-apple-darwin19.6.0) Program_Error sem_type.adb:837 explicit
raise|
| Error detected at aarm_202x_ch04.adb:605:21

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

* [Bug ada/106037] ICE with Aggregate aspect
  2022-06-20 22:38 [Bug ada/106037] New: ICE with Aggregate aspect jesper.quorning at gmail dot com
  2022-07-01 11:07 ` [Bug ada/106037] " ebotcazou at gcc dot gnu.org
  2022-07-02 16:16 ` p.p11 at orange dot fr
@ 2024-03-13 15:11 ` simon at pushface dot org
  2024-03-13 15:40 ` [Bug ada/106037] internal error with Aggregate aspect on array type ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: simon at pushface dot org @ 2024-03-13 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

simon at pushface dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon at pushface dot org

--- Comment #4 from simon at pushface dot org ---
This is illegal code: 'aspect "Aggregate" can only be applied to non-array
type'.

See https://groups.google.com/g/comp.lang.ada/c/FHWcqk1SWRM/m/sYTWUHQxAgAJ,
and the (slightly unemphatically worded) ARM 4.3.5(2), "For a type other
than an array type, the following type-related operational aspect may be
specified"

GNAT 14.0.1 20240223 (experimental)
Copyright 1992-2024, Free Software Foundation, Inc.


Compiling: container_aggregates.adb
Source file time stamp: 2024-03-13 15:04:00
Compiled at: 2024-03-13 15:04:53

     1. procedure Container_Aggregates is
     2.
     3.    type Array_Type is
     4.      array (1 .. 10) of Integer
     5.    with Aggregate => (Empty => Empty_Array);
                1            2         3
        >>> error: aspect "Aggregate" can only be applied to non-array type
        >>> error: incomplete specification for aggregate
        >>> error: object "Empty_Array" cannot be used before end of its
declaration
        >>> error: improper aggregate operation for "Array_Type"

     6.
     7.    Empty_Array : constant Array_Type := [1..10 => 123];
     8.
     9. begin
    10.    null;
    11. end Container_Aggregates;
    12.

 12 lines: 4 errors

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

* [Bug ada/106037] internal error with Aggregate aspect on array type
  2022-06-20 22:38 [Bug ada/106037] New: ICE with Aggregate aspect jesper.quorning at gmail dot com
                   ` (2 preceding siblings ...)
  2024-03-13 15:11 ` simon at pushface dot org
@ 2024-03-13 15:40 ` ebotcazou at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-03-13 15:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |13.3
            Summary|ICE with Aggregate aspect   |internal error with
                   |                            |Aggregate aspect on array
                   |                            |type
         Resolution|---                         |FIXED

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
commit ec48b99c24a422bf97af91e82203d23b69094e7c
Author: Marc Poulhiès <poulhies@adacore.com>
Date:   Wed Mar 8 20:39:45 2023 +0100

    ada: Fix error message for Aggregate aspect

    The error message was wrongly using % instead of & in the format string,
    causing the displayed message to refer to incorrect names in some cases.

    gcc/ada/

            * sem_ch13.adb (Check_Aspect_At_Freeze_Point): fix format string,
            use existing local Ident.

commit 3da0e4ae25f15949f87e74aa96a03b47e51a9ff3
Author: Marc Poulhiès <poulhies@adacore.com>
Date:   Mon Mar 6 12:15:13 2023 +0100

    ada: Fix (again) incorrect handling of Aggregate aspect

    Previous fix stopped the processing of the Aggregate aspect early,
    skipping the call to Record_Rep_Item, making later call to
    Resolve_Container_Aggregate fail.

    Also, the previous fix would not handle correctly the case where the
    type is private and the check for non-array type can only be done at the
    freeze point with the full type.

    Adapt the resolving of the aspect when the input is not correct and the
    parameters can't be resolved.

    gcc/ada/

            * sem_ch13.adb (Analyze_One_Aspect): Call Record_Rep_Item.
           (Check_Aspect_At_Freeze_Point): Check the aspect is specified on
            non-array type only...
            (Analyze_One_Aspect): ... instead of doing it too early here.
            * sem_aggr.adb (Resolve_Container_Aggregate): Do nothing in case
            the parameters failed to resolve.

commit fd694822ca6eda8b08fea10fcabdb0ad508a963e
Author: Marc Poulhiès <poulhies@adacore.com>
Date:   Tue Feb 28 17:10:29 2023 +0100

    ada: Fix incorrect handling of Aggregate aspect

    This change fixes 2 incorrect handlings of the aspect.
    The arguments are now correctly resolved and the aspect is rejected on
    non array types.

    gcc/ada/
            * sem_ch13.adb (Analyze_One_Aspect): Mark Aggregate aspect as
            needing delayed resolution and reject the aspect on non-array
            type.

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

end of thread, other threads:[~2024-03-13 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20 22:38 [Bug ada/106037] New: ICE with Aggregate aspect jesper.quorning at gmail dot com
2022-07-01 11:07 ` [Bug ada/106037] " ebotcazou at gcc dot gnu.org
2022-07-02 16:16 ` p.p11 at orange dot fr
2024-03-13 15:11 ` simon at pushface dot org
2024-03-13 15:40 ` [Bug ada/106037] internal error with Aggregate aspect on array type 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).