In the attached code, the symbol _f732b00__change_discriminated_typeInvariant is generated as defined (T) in a code unit that should only reference it (U). $ gnatmake -gnatws -O2 c732b02.adb gcc -c -gnatws -O2 c732b02.adb gcc -c -gnatws -O2 f732b00.adb gcc -c -gnatws -O2 report.adb gnatbind -x c732b02.ali gnatlink c732b02.ali -O2 duplicate symbol _f732b00__change_discriminated_typeInvariant in: ./f732b00.o ./c732b02.o ld: 1 duplicate symbol for architecture x86_64 collect2: error: ld returned 1 exit status gnatlink: error when calling /opt/gcc-7.1.0/bin/gcc gnatmake: *** link failed. The same failure occurs with GNAT GPL 2016, but not with GCC 6.1.0, 5.2.0 (for which the test passes).
Created attachment 41370 [details] Reproducer
. *** This bug has been marked as a duplicate of bug 80784 ***