Bug: variable declared in a unit and
frank at g-n-u.de
Sun Apr 13 19:29:38 CEST 2003
Jean-Pierre Vial wrote:
> One of my programs works fine with GPC2.1/gcc2.95.3
> it does not compile with 2003/03/23
> I could isolate the problem (out of a 5000 lines source)
> to two small units (see below)
> The original unit declaz contains global variables and procedure common to
> almost all the rest of the program.
> Ttwo of its (public) variables are masked in the implementation part of
> another unit by a variable with the same name (not a bug).
> There is a warning for this situation: fine, but not so fine, all the
> variables declared after the warning are ignored, and trigger errors when
> they appear later.
> To see it happen, copy the two sources below as gdeclaz.pas and gimpragr.pas,
> and try
> gpc --automake -c gimpragr.pas
> I get
> jp at brea:~/agreg/src/pascal> gpc --automake -c gimpragr.pas
> gimpragr.pas:21: redeclaration of `l132'
> gdeclaz.pas:6: previous declaration
> gimpragr.pas: In procedure `presidence':
> gimpragr.pas:23: undeclared identifier `president' (first use in this routine)
> gimpragr.pas:23: (Each undeclared identifier is reported only once
> gimpragr.pas:23: for each routine it appears in.)
> gimpragr.pas:23: undeclared identifier `presidente' (first use in this
So, where's a warning?
Frank Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707
More information about the Gpc