[Bug ada/54178] New: qualifying a record aggregate incorrectly hides names in local instantiation
georggcc at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Sun Aug 5 09:08:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54178
Bug #: 54178
Summary: qualifying a record aggregate incorrectly hides names
in local instantiation
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: georggcc@googlemail.com
Qualifying the actual parameter with its type seems to
trigger the bug.
While the surrounding declarations and equivalent instantiations
work fine with the very same objects involved (W, H),
Test_3 is rejected, the only difference being a CGSize'
attached to the aggregate.
package G is
type CGFloat is digits 5 range 0.0 .. 4_096.0;
type CGSize is record
Width : CGFloat;
Height : CGFloat;
end record;
end G;
generic
Frame : CGSize;
Formal : CGFloat;
package G.Chld is end;
with G.Chld;
with Ada.Command_Line;
procedure Test_Inst is
use G;
procedure Inner_Proc
(W : Positive;
H : Positive);
-- instantiates G.Chld using values made from W and H,
-- cf. Test_3 versus surrounding
procedure Inner_Proc
(W : Positive;
H : Positive)
is
Test_1 : constant CGSize :=
CGSize'(Width => CGFloat (W),
Height => CGFloat (H));
subtype Test_2 is CGFloat range CGFloat (W) .. CGFloat (H);
package Test_3 is new Chld -- W, H not visible?
(Frame => CGSize'(Width => CGFloat (W),
Height => CGFloat (H)),
Formal => CGFloat (H));
package Test_4 is new Chld
(Frame => (Width => CGFloat (W),
Height => CGFloat (H)),
Formal => CGFloat (H));
package Test_5 is new Chld
(Frame => CGSize'(Width => CGFloat (Standard.Test_Inst.Inner_Proc.W),
Height => CGFloat (Standard.Test_Inst.Inner_Proc.H)),
Formal => CGFloat (H));
package Test_6 is new Chld
(Frame => Test_1,
Formal => CGFloat (H));
begin
null;
end Inner_Proc;
use Ada.Command_Line;
X, Y : Natural;
begin
X := Natural'Value (Argument (1));
Y := Natural'Value (Argument (2));
Inner_Proc (X, Y);
end Test_Inst;
$ gnatmake -gnatcvf test_inst.adb
gcc -c -gnatcvf test_inst.adb
GNAT 4.8.0 20120804 (experimental) [trunk revision 190143]
Copyright 1992-2012, Free Software Foundation, Inc.
Checking: test_inst.adb (source file time stamp: 2012-08-05 08:57:26)
==============Error messages for source file: test_inst.adb
--------------Line numbers from file: vis.ada (starting at line 16)
40. (Frame => CGSize'(Width => CGFloat (W),
|
>>> "W" is not visible
>>> non-visible declaration at line 24
41. Height => CGFloat (H)),
|
>>> "H" is not visible
>>> non-visible declaration at line 25
55 lines: 4 errors
gnatmake: "test_inst.adb" compilation error
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/Users/bauhaus/mine/libexec/gcc/x86_64-apple-darwin11.4.0/4.8.0/lto-wrapper
Target: x86_64-apple-darwin11.4.0
Configured with: /Users/bauhaus/src/gcc/configure --prefix=/Users/bauhaus/mine
--disable-nls --disable-multilib --disable-libstdcxx-pch CC='gcc
-D_FORTIFY_SOURCE=0' --enable-languages=c,ada,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.8.0 20120804 (experimental) [trunk revision 190143] (GCC)
$ sysctl machdep.cpu.brand_string
machdep.cpu.brand_string: Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz
$ uname -a
Darwin localhost 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr 9 19:32:15 PDT
2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
More information about the Gcc-bugs
mailing list