diff --git a/.gitattributes b/.gitattributes index 8c6030c588..df3d0ff097 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/rautils.pas b/compiler/rautils.pas index 334aad6030..ae6f6d46e1 100644 --- a/compiler/rautils.pas +++ b/compiler/rautils.pas @@ -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; diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 02dbae09dd..7c5e434761 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -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 diff --git a/tests/tbs/tb0468a.pas b/tests/tbs/tb0468a.pas new file mode 100644 index 0000000000..adbebc8ca6 --- /dev/null +++ b/tests/tbs/tb0468a.pas @@ -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. +