ソースを参照

* write align opcode in text sections in case of gas output, fixes #7440

git-svn-id: trunk@4702 -
florian 19 年 前
コミット
d15f5871c2
3 ファイル変更23 行追加3 行削除
  1. 1 0
      .gitattributes
  2. 8 3
      compiler/aggas.pas
  3. 14 0
      tests/webtbs/tw7440.pp

+ 1 - 0
.gitattributes

@@ -7332,6 +7332,7 @@ tests/webtbs/tw7276.pp svneol=native#text/plain
 tests/webtbs/tw7372.pp svneol=native#text/plain
 tests/webtbs/tw7379.pp svneol=native#text/plain
 tests/webtbs/tw7425.pp svneol=native#text/plain
+tests/webtbs/tw7440.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 8 - 3
compiler/aggas.pas

@@ -233,8 +233,8 @@ implementation
         // if paratargetdbg = dbg_dwarf then
         //  result := result + ' --gdwarf-2';
       end;
-    
-    
+
+
     function TGNUAssembler.NextSetLabel: string;
       begin
         inc(setcount);
@@ -529,7 +529,12 @@ implementation
                      begin
                        AsmWrite(#9'.balign '+tostr(tai_align_abstract(hp).aligntype));
                        if tai_align_abstract(hp).use_op then
-                        AsmWrite(','+tostr(tai_align_abstract(hp).fillop))
+                         AsmWrite(','+tostr(tai_align_abstract(hp).fillop))
+{$ifdef x86}
+                       { force NOP as alignment op code }
+                       else if CurrSecType=sec_code then
+                         AsmWrite(',90');
+{$endif x86}
                      end
                    else
                      begin

+ 14 - 0
tests/webtbs/tw7440.pp

@@ -0,0 +1,14 @@
+{ %CPU=i386 %OPT=-S2cgi -OG2 -gl -al }
+program bugloop;
+
+{$mode objfpc}
+
+var
+  d: array[0..0] of double;
+  i: integer;
+
+begin
+  for i := low(d) to high(d) do
+    d[i] := i;
+  writeln('ok');
+end.