Bug 24079 - Ada FE ICE on protected procedure with default argument (invalid?)
Summary: Ada FE ICE on protected procedure with default argument (invalid?)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.0.1
: P2 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2005-09-27 09:01 UTC by Kat Zygfryd
Modified: 2008-04-12 15:08 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 4.4.0
Known to fail: 4.3.0 4.3.1
Last reconfirmed: 2005-09-27 18:24:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kat Zygfryd 2005-09-27 09:01:16 UTC
This bug is triggered by assigning a private variable of a protected object as
the default expression of its private protected procedure's parameter.

-----------------------------------------------------------------------------

$ gnatgcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gnat-4.01/work/gcc-4.0.1/configure
--prefix=/usr --program-prefix=gnat --enable-languages=c,ada --enable-libada
--with-gcc --with-gnu-ld --with-gnu-as --enable-threads=posix --enable-shared
--with-system-zlib --disable-nls --libdir=/usr/lib/ada
--libexecdir=/usr/libexec/ada --mandir=/usr/share/man --infodir=/usr/share/info
Thread model: posix
gcc version 4.0.1

-----------------------------------------------------------------------------

$ gnatmake bug
gnatgcc -c bug.adb
+===========================GNAT BUG DETECTED==============================+
| 4.0.1 (i686-pc-linux-gnu) Assert_Failure atree.adb:812                   |
| Error detected at bug.adb:15:50                                          |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

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.

bug.adb

compilation abandoned
gnatmake: "bug.adb" compilation error

-----------------------------------------------------------------------------

-------- begin file: bug.adb --------
procedure Bug is

   protected Object is

      entry Trigger;

   private

      Private_Variable : Integer;

   end Object;

   protected body Object is

      procedure Bug_Happens_Here (I : Integer := Private_Variable) is
      begin
         null;
      end Bug_Happens_Here;

      entry Trigger
         when True is
      begin
         Bug_Happens_Here;
      end Trigger;

   end Object;

begin
   null;
end Bug;
-------- end file: bug.adb --------
Comment 1 Laurent GUERBY 2005-09-27 18:24:21 UTC
ICE on all versions including HEAD. I would say this is not legal Ada since RM
6.4.1(5) allows a default_expression to be a variable name but here you put a
protected object component name, so for now I set this PR as ice-on-invalid.
On the other hand, I'm not sure this would pose implementation issues (just copy
after taking the lock) or semantic constraints (once lock taken value can't
change) to allow this construct (may be AI?).

| 3.3.5 20050117 (prerelease) (SUSE Linux) (i586-suse-linux-gnu)           |
| Assert_Failure atree.adb:677                                             |
| Error detected at bug.adb:15:50                                          |

| 3.4.4 (i686-pc-linux-gnu) Assert_Failure atree.adb:703                   |
| Error detected at bug.adb:15:50                                          |

| 4.0.1 (i686-pc-linux-gnu) Assert_Failure atree.adb:812                   |
| Error detected at bug.adb:15:50                                          |

| 4.1.0 20050925 (experimental) (i686-pc-linux-gnu) Assert_Failure atree.adb:812|
| Error detected at bug.adb:15:50                                          |
Comment 2 jeff 2006-10-20 17:03:52 UTC
Still there in head

gcc -c bug.adb
+===========================GNAT BUG DETECTED==============================+
| 4.2.0 20061020 (experimental) (i686-pc-linux-gnu) Assert_Failure atree.adb:812
Comment 3 Samuel Tardieu 2008-04-12 15:08:24 UTC
This appears to be fixed in SVN trunk (4.4.0).