A discriminant_association can only contain an expression (RM 3.7.1(3)); in
contrast, a record_component_association can contain either an expression or a
box <> (RM 4.3.1(4/2)); however th box is illegal if the component is a
discriminant without a defaut value; this is consistent with a
discriminant_association.  The following program is therefore illegal:

package pak1 is
   type T1(b: boolean) is null record;

   type T2 is record
      a1: T1(false);
   end record;

   x1: constant T2 := (a1 => <>); -- line 8

end pak1;

In line 8, the <> is illegal because it is part of a
record_component_association for a discriminant that has no default value.

GCC crashes on this illegal program:

+===========================GNAT BUG DETECTED==============================+
| 4.3.0 (i686-unknown-linux-gnu) Assert_Failure atree.adb:3816             |

gcc-4.3 -c pak1.ads
+===========================GNAT BUG DETECTED==============================+
| 4.3.3 (x86_64-pc-linux-gnu) Assert_Failure atree.adb:3816                |
| Error detected at pak1.ads:8:23                                          |

gcc-4.4 -c pak1.ads
+===========================GNAT BUG DETECTED==============================+
| 4.4.1 (x86_64-pc-linux-gnu) Assert_Failure atree.adb:3815                |
| Error detected at pak1.ads:8:23                                          |


-- 
           Summary: ICE in illegal program, Assert_Failure atree.adb:3815,
                    RM 4.3.1(17.1/2)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40932

Reply via email to