https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95664

            Bug ID: 95664
           Summary: generic instantiation fails to detect abstract
                    equality, builds with gcc-9 and fails to link with
                    gcc-10
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nicolas at debian dot org
  Target Milestone: ---

Hello.
A minimal reproducer follows.

With gcc-9.3.0 (Debian build 13), all goes well,
but gcc-10.1.0 (Debian build 3) fails to link:
# /usr/bin/ld: ./pkg.o: in function `pkg__instantiation':                       
# pkg.ads:(.text+0x9): undefined reference to `pkg__Oeq'                        

If the source is valid Ada code (I am not quite sure),
then gcc-9 is right and gcc-10 introduces a regression,
else both versions should report an error instead of their current behaviour.

cat > gen_proc.ads <<EOF                                                        
generic                                                                         
   type Data is private;                                                        
   with function Eq (L, R : Data) return Boolean is "=";                        
procedure Gen_Proc (X : Data);                                                  
EOF                                                                             
cat > gen_proc.adb <<EOF                                                        
procedure Gen_Proc (X : Data) is                                                
   B : Boolean := Eq (X, X);                                                    
begin                                                                           
   null;                                                                        
end Gen_Proc;                                                                   
EOF                                                                             
cat > pkg.ads <<EOF                                                             
with Gen_Proc;                                                                  
package Pkg is                                                                  
   type Element is null record;                                                 
   function "=" (L,R : Element) return Boolean is abstract;                     
   procedure Instantiation is new Gen_Proc (Element);                           
end Pkg;                                                                        
EOF                                                                             
cat > main.adb <<EOF                                                            
with Pkg;                                                                       
procedure Main is                                                               
begin                                                                           
   null;                                                                        
end Main;                                                                       
EOF                                                                             
gnatmake main.adb

Reply via email to