mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 02:09:33 +02:00
* Calling tlabelsym.mangledname should not define the label. This was causing "already defined" errors if a label was referenced before it was defined.
+ Test. + Check duplicate labels in assembler blocks. This was impossible due to above bug and duplicate labels were detected only at assembling stage where no location information could be provided. git-svn-id: trunk@27472 -
This commit is contained in:
parent
e43791cf7c
commit
adc8cdb5af
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10059,6 +10059,7 @@ tests/tbs/tb0465.pp svneol=native#text/plain
|
||||
tests/tbs/tb0466.pp svneol=native#text/plain
|
||||
tests/tbs/tb0467.pp svneol=native#text/plain
|
||||
tests/tbs/tb0468.pp svneol=native#text/plain
|
||||
tests/tbs/tb0468a.pas svneol=native#text/plain
|
||||
tests/tbs/tb0469.pp svneol=native#text/plain
|
||||
tests/tbs/tb0470.pp svneol=native#text/plain
|
||||
tests/tbs/tb0471.pp svneol=native#text/plain
|
||||
|
@ -1513,7 +1513,11 @@ Begin
|
||||
current_asmdata.getjumplabel(tlabelsym(sym).asmblocklabel);
|
||||
hl:=tlabelsym(sym).asmblocklabel;
|
||||
if emit then
|
||||
tlabelsym(sym).defined:=true
|
||||
begin
|
||||
if tlabelsym(sym).defined then
|
||||
Message(sym_e_label_already_defined);
|
||||
tlabelsym(sym).defined:=true
|
||||
end
|
||||
else
|
||||
tlabelsym(sym).used:=true;
|
||||
SearchLabel:=true;
|
||||
|
@ -625,9 +625,8 @@ implementation
|
||||
|
||||
function tlabelsym.mangledname:TSymStr;
|
||||
begin
|
||||
if not(defined) then
|
||||
if (asmblocklabel=nil) then
|
||||
begin
|
||||
defined:=true;
|
||||
if nonlocal then
|
||||
current_asmdata.getglobaljumplabel(asmblocklabel)
|
||||
else
|
||||
|
27
tests/tbs/tb0468a.pas
Normal file
27
tests/tbs/tb0468a.pas
Normal file
@ -0,0 +1,27 @@
|
||||
{ %OPT=-Sg }
|
||||
|
||||
procedure foo;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure test;
|
||||
label
|
||||
a,b,c,d;
|
||||
const
|
||||
x: array[0..3] of pointer=(@a,@b,@c,@d);
|
||||
begin
|
||||
foo;
|
||||
a:
|
||||
foo;
|
||||
b:
|
||||
foo;
|
||||
c:
|
||||
foo;
|
||||
d:
|
||||
foo;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user