> This should then trigger the use of DW_OP_GNU_variable_value but
> for the Ada ACATS testcase I was looking at to debug the issue
> (c330001, resp. c330001_0-c330001_1.ads) this doesn't work
> because the constraints are not met (we're in global context and
> the upper bound decl is global as well). Jakub, do you remember
> a reason for having any constraints here? I've reworked the
> constraints to allow the globals (eventually using decl_function_context
> on this may also allow other not-quite-local cases? But it already
> allowed local statics). Maybe we can simply drop the restriction
> alltogether?
Thanks for looking into this.
> Eric, can you generate a gnat.dg LTO testcase from (reduced) c330001?
Attached.
* gnat.dg/lto22.adb: New test.
* gnat.dg/lto22_pkg1.ad[sb]: New helper.
* gnat.dg/lto22_pkg2.ads: Likewise.
--
Eric Botcazou
with Lto22_Pkg2; use Lto22_Pkg2;
package Lto22_Pkg1 is
Public_1 : Rec := F;
end Lto22_Pkg1;
package body Lto22_Pkg2 is
function F return Rec is
Var_1 : Rec;
begin
return Var_1;
end;
end Lto22_Pkg2;
package Lto22_Pkg2 is
subtype Index_Type is Integer range 1 .. 20;
type Rec (<>) is private;
function F return Rec;
private
type Rec (D : Index_Type := 2) is record
S : String (1 .. D) := "Hi";
end record;
end Lto22_Pkg2;
-- { dg-do run }
-- { dg-options "-g -flto" { target lto } }
with Lto22_Pkg1;
procedure Lto22 is
begin
null;
end;