public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nicolas at debian dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/95664] New: generic instantiation fails to detect abstract equality, builds with gcc-9 and fails to link with gcc-10
Date: Sat, 13 Jun 2020 13:42:09 +0000	[thread overview]
Message-ID: <bug-95664-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2020-06-13 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-13 13:42 nicolas at debian dot org [this message]
2020-06-13 16:01 ` [Bug ada/95664] " ludovic@ludovic-brenta.org
2020-06-14  5:21 ` rosen at adalog dot fr
2020-06-29 11:10 ` [Bug ada/95664] link failure with abstract equality operator ebotcazou at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95664-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).