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

            Bug ID: 89609
           Summary: bug box caused by access to function as a record
                    component via a limited with
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nicolas at debian dot org
  Target Milestone: ---

These sources should be legal. Execution would dereference a null pointer, but
this is easy to fix without changing the bug box below.

limited with Rs;                                                               
package As is                                                                  
   type A is access function return Rs.R;                                      
end As;                                                                        

with As;                                                                       
package Rs is                                                                  
   type R is record                                                            
      F : As.A;                                                                
   end record;                                                                 
   X : R;                                                                      
   Y : R := X.F.all;                                                           
end Rs;                                                                        

gnatmake -c rs.ads
produces:

+===========================GNAT BUG DETECTED==============================+
| 8.2.0 (x86_64-linux-gnu) GCC error:                                      |
| in save_gnu_tree, at ada/gcc-interface/utils.c:337                       |
| Error detected at rs.ads:3:4                                             |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| 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.                                       |
+==========================================================================+

This has similarities with Bug 89159, but no tagged type is implied.

Reply via email to