Browse Source

* print an "invalid segment override expression" error message in case a segment
override uses an invalid (non-segment) register in the x86 inline asm reader
(both for intel and att syntax)

git-svn-id: trunk@38391 -

nickysn 7 years ago
parent
commit
df6a870873
2 changed files with 4 additions and 0 deletions
  1. 2 0
      compiler/x86/rax86att.pas
  2. 2 0
      compiler/x86/rax86int.pas

+ 2 - 0
compiler/x86/rax86att.pas

@@ -745,6 +745,8 @@ Implementation
                Begin
                Begin
                  Consume(AS_COLON);
                  Consume(AS_COLON);
                  oper.InitRef;
                  oper.InitRef;
+                 if not is_segment_reg(tempreg) then
+                   Message(asmr_e_invalid_seg_override);
                  oper.opr.ref.segment:=tempreg;
                  oper.opr.ref.segment:=tempreg;
                  { This must absolutely be followed by a reference }
                  { This must absolutely be followed by a reference }
                  if not MaybeBuildReference then
                  if not MaybeBuildReference then

+ 2 - 0
compiler/x86/rax86int.pas

@@ -860,6 +860,8 @@ Unit Rax86int;
       begin
       begin
         if oper.opr.typ<>OPR_REFERENCE then
         if oper.opr.typ<>OPR_REFERENCE then
           internalerror(2018022801);
           internalerror(2018022801);
+        if not is_segment_reg(seg) then
+          Message(asmr_e_invalid_seg_override);
         if oper.opr.ref.segment<>NR_NO then
         if oper.opr.ref.segment<>NR_NO then
           begin
           begin
             if m_tp7 in current_settings.modeswitches then
             if m_tp7 in current_settings.modeswitches then