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

            Bug ID: 70900
           Summary: a library-level class-wide subprogram is not generated
                    into .o/.s
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: demoonlit at panathenaia dot halfmoon.jp
  Target Milestone: ---

gcc-6.1.0 does not generate machine-code for some kind of library-level
class-wide subprograms into .o/.s.

Minor difference of nest-level, profile, or body of it affects possible to
reproduce. I have not found the detailed condition, but found one reproducible
small code, below:

package p is
   type t is tagged null record;
end p;

with p;
function p.liblevelcwsubp (obj : p.t'class) return p.t'class is
begin
   return obj;
end p.liblevelcwsubp;

% x86_64-apple-darwin10-gcc -c p-liblevelcwsubp.adb
% nm p-liblevelcwsubp.o
nm: no name list

% x86_64-pc-linux-gnu-gcc -c p-liblevelcwsubp.adb
% x86_64-pc-linux-gnu-nm p-liblevelcwsubp.o
(empty output)

% x86_64-apple-darwin10-gcc -S p-liblevelcwsubp.adb
% cat p-liblevelcwsubp.s
        .subsections_via_symbols
(end of file)

% x86_64-pc-linux-gnu-gcc -S p-liblevelcwsubp.adb 
% cat p-liblevelcwsubp.s
        .file   "p-liblevelcwsubp.adb"
        .ident  "GCC: (GNU) 6.1.0"
        .section        .note.GNU-stack,"",@progbits
(end of file)

% x86_64-apple-darwin10-gcc --version
x86_64-apple-darwin10-gcc (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% x86_64-pc-linux-gnu-gcc --version
x86_64-pc-linux-gnu-gcc (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

----------

gcc-5 works:

% gcc -c p-liblevelcwsubp.adb
% nm p-liblevelcwsubp.o
0000000000000230 s EH_frame1
                 U ___gnat_rcheck_CE_Access_Check
                 U ___gnat_rcheck_PE_Accessibility_Check
0000000000000000 T __ada_p__liblevelcwsubp
                 U _memcpy
                 U _system__secondary_stack__ss_allocate

% gcc -S p-liblevelcwsubp.adb
% cat p-liblevelcwsubp.s
        .const
LC0:
        .ascii "p-liblevelcwsubp.adb"
        .space 1
        .text
        .globl __ada_p__liblevelcwsubp
__ada_p__liblevelcwsubp:
LFB2:
        pushq   %rbp
LCFI0:
        movq    %rsp, %rbp
(...more contents)

% gcc --version
gcc (GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to