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 --------
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 |
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
This appears to be fixed in SVN trunk (4.4.0).