https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68849
Bug ID: 68849 Summary: Bug box when using a type with static predicate as formal parameter of generic procedure Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: lars.schulna at gmail dot com Target Milestone: --- Created attachment 36990 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36990&action=edit Source file triggering the bug Hello, I ran into a gnat internal error while compiling the following file. main.adb: function Main return Integer is type I is new Integer with Static_Predicate => True; -- with Dynamic_Predicate => True; -- 1 generic type T is private; procedure P (X : T); procedure P (X : T) is null; -- procedure P; -- 2 -- procedure P is null; -- 2 procedure P_Inst is new P (I); -- 3 begin return 0; end Main; $ gcc -v -save-temps -gnatd.n -c main.adb Using built-in specs. COLLECT_GCC=gcc Target: x86_64-unknown-linux-gnu Configured with: /build/gcc/src/gcc-5.3.0/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 5.3.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-gnatd.n' '-c' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/gnat1 -quiet -dumpbase main.adb -auxbase main -gnatd.n -mtune=generic -march=x86-64 main.adb -o main.s /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/system.ads main.adb /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/ada.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/a-textio.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/a-ioexce.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/a-stream.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-ficobl.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/interfac.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/i-cstrea.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-crtl.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-parame.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-wchcon.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-stalib.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/a-unccon.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-exctab.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/a-tags.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-stoele.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-soflin.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/a-except.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-traent.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-stache.ads /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/adainclude/s-unstyp.ads +===========================GNAT BUG DETECTED==============================+ | 5.3.0 (x86_64-unknown-linux-gnu) GCC error: | | in gnat_to_gnu_entity, at ada/gcc-interface/decl.c:4445 | | Error detected at main.adb:12:4 [main.adb:18:4] | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | 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. | +==========================================================================+ 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. Consider also -gnatd.n switch (see debug.adb). main.adb compilation abandoned To trigger this bug, the type I has to have a Static_Predicate or (as seen in the comment marked with -- 1) a Dynamic_Predicate. However, this bug is *not* triggered when the type T is not used in P (as seen in the comment marked with --2) or when it's never instantiated (line marked with -- 3). I was able to reproduce it with the adacore libre version (gnat-gpl-2015-x86_64-linux-bin.tar.gz) from http://libre.adacore.com/download/configurations on a x86_64 Linux machine. I used the latter configuration first and it told me to write to rep...@adacore.com, which I did. That was a week ago and there wasn't any reaction. I'm sorry if this bug report is redundant.