* [Ada] Crash on ambiguous allocator expression
@ 2017-04-27 9:16 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-04-27 9:16 UTC (permalink / raw)
To: gcc-patches; +Cc: Justin Squirek
[-- Attachment #1: Type: text/plain, Size: 955 bytes --]
This patch corrects a crash that was produced when comparing "null" to an
allocator due to type Any_Access being improperly setup with no designated
type. Because both operands require a specific type from context such a case
will now emit the proper "ambiguous operands" error.
------------
-- Source --
------------
-- forty_two.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Forty_Two is
type R is record
A : Boolean;
end record;
B : Boolean;
begin
B := (null = new R);
end;
----------------------------
-- Compilation and output --
----------------------------
& gnatmake -q forty_two.adb
forty_two.adb:8:14: ambiguous operands for equality
gnatmake: "forty_two.adb" compilation error
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-04-27 Justin Squirek <squirek@adacore.com>
* cstand.adb (Create_Standard): Correctly set
Directly_Designated_Type for Any_Access.
* sem_type.adb (Covers): Minor grammar fixes.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 1845 bytes --]
Index: cstand.adb
===================================================================
--- cstand.adb (revision 247293)
+++ cstand.adb (working copy)
@@ -1194,6 +1194,7 @@
Set_Etype (Any_Access, Any_Access);
Init_Size (Any_Access, System_Address_Size);
Set_Elem_Alignment (Any_Access);
+ Set_Directly_Designated_Type (Any_Access, Any_Type);
Any_Character := New_Standard_Entity ("a character type");
Set_Ekind (Any_Character, E_Enumeration_Type);
Index: sem_type.adb
===================================================================
--- sem_type.adb (revision 247293)
+++ sem_type.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -802,8 +802,8 @@
-- Start of processing for Covers
begin
- -- If either operand missing, then this is an error, but ignore it (and
- -- pretend we have a cover) if errors already detected, since this may
+ -- If either operand is missing, then this is an error, but ignore it
+ -- and pretend we have a cover if errors already detected since this may
-- simply mean we have malformed trees or a semantic error upstream.
if No (T1) or else No (T2) then
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-27 9:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 9:16 [Ada] Crash on ambiguous allocator expression Arnaud Charlet
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).