Browse Source

Rebase to revision 19673

pexpr.pas: Changes in postfixoperators and the base of handle_factor_typenode not yet incorporated (the code from trunk was simply commented for now)

git-svn-id: branches/svenbarth/generics@19676 -
svenbarth 13 years ago
parent
commit
4419dc3d34
100 changed files with 3756 additions and 1589 deletions
  1. 137 35
      .gitattributes
  2. 0 18
      .gitignore
  3. 9 2
      compiler/Makefile
  4. 8 0
      compiler/Makefile.fpc
  5. 19 4
      compiler/aasmdata.pas
  6. 21 10
      compiler/aasmtai.pas
  7. 11 3
      compiler/aggas.pas
  8. 2 7
      compiler/aoptobj.pas
  9. 15 7
      compiler/arm/cgcpu.pas
  10. 4 0
      compiler/arm/cpuinfo.pas
  11. 83 25
      compiler/arm/narmmat.pas
  12. 96 91
      compiler/arm/raarmgas.pas
  13. 20 7
      compiler/asmutils.pas
  14. 12 10
      compiler/assemble.pas
  15. 47 7
      compiler/ccharset.pas
  16. 159 6
      compiler/cclasses.pas
  17. 2 2
      compiler/cfileutl.pas
  18. 42 34
      compiler/cgobj.pas
  19. 8 2
      compiler/cmsgs.pas
  20. 24 27
      compiler/constexp.pas
  21. 2 1
      compiler/cp1251.pas
  22. 282 0
      compiler/cp1252.pp
  23. 2 1
      compiler/cp437.pas
  24. 2 1
      compiler/cp850.pas
  25. 2 1
      compiler/cp866.pas
  26. 2 1
      compiler/cp8859_1.pas
  27. 2 1
      compiler/cp8859_5.pas
  28. 191 0
      compiler/cpid.pas
  29. 11 7
      compiler/cresstr.pas
  30. 10 10
      compiler/cstreams.pas
  31. 19 10
      compiler/dbgdwarf.pas
  32. 64 12
      compiler/defcmp.pas
  33. 11 0
      compiler/defutil.pas
  34. 3 0
      compiler/fmodule.pas
  35. 9 0
      compiler/fpcdefs.inc
  36. 2 2
      compiler/gendef.pas
  37. 7 4
      compiler/globals.pas
  38. 31 24
      compiler/globtype.pas
  39. 28 17
      compiler/htypechk.pas
  40. 10 21
      compiler/i386/daopt386.pas
  41. 30 30
      compiler/i386/i386tab.inc
  42. 2 62
      compiler/i386/n386mem.pas
  43. 0 88
      compiler/i386/n386set.pas
  44. 6 6
      compiler/impdef.pas
  45. 34 2
      compiler/link.pas
  46. 24 7
      compiler/m68k/cpupara.pas
  47. 4 4
      compiler/machoutils.pas
  48. 13 0
      compiler/mips/cgcpu.pas
  49. 0 75
      compiler/mips/rmipsmot.inc
  50. 0 75
      compiler/mips/rmipsmri.inc
  51. 56 8
      compiler/msg/errore.msg
  52. 17 2
      compiler/msgidx.inc
  53. 383 362
      compiler/msgtxt.inc
  54. 153 15
      compiler/nadd.pas
  55. 3 3
      compiler/nbas.pas
  56. 19 6
      compiler/ncal.pas
  57. 4 0
      compiler/ncgcal.pas
  58. 6 4
      compiler/ncgcnv.pas
  59. 13 17
      compiler/ncgcon.pas
  60. 89 145
      compiler/ncgflw.pas
  61. 1 2
      compiler/ncginl.pas
  62. 3 2
      compiler/ncgld.pas
  63. 0 2
      compiler/ncgmem.pas
  64. 0 2
      compiler/ncgobjc.pas
  65. 6 8
      compiler/ncgutil.pas
  66. 195 31
      compiler/ncnv.pas
  67. 92 7
      compiler/ncon.pas
  68. 2 0
      compiler/nflw.pas
  69. 20 6
      compiler/ninl.pas
  70. 28 5
      compiler/nld.pas
  71. 63 4
      compiler/nmat.pas
  72. 1 1
      compiler/nmem.pas
  73. 14 11
      compiler/node.pas
  74. 39 9
      compiler/nopt.pas
  75. 16 2
      compiler/nutils.pas
  76. 0 5
      compiler/objcgutl.pas
  77. 3 1
      compiler/ogcoff.pas
  78. 10 2
      compiler/ogelf.pas
  79. 3 3
      compiler/ognlm.pas
  80. 4 4
      compiler/optdead.pas
  81. 40 31
      compiler/options.pas
  82. 1 1
      compiler/opttail.pas
  83. 4 1
      compiler/paramgr.pas
  84. 0 1
      compiler/parser.pas
  85. 3 1
      compiler/pass_2.pas
  86. 23 0
      compiler/pdecl.pas
  87. 10 4
      compiler/pdecobj.pas
  88. 24 7
      compiler/pdecsub.pas
  89. 31 12
      compiler/pdecvar.pas
  90. 780 39
      compiler/pexpr.pas
  91. 27 7
      compiler/pinline.pas
  92. 2 2
      compiler/pmodules.pas
  93. 3 0
      compiler/powerpc/agppcmpw.pas
  94. 2 16
      compiler/powerpc/nppcmat.pas
  95. 3 17
      compiler/powerpc64/cgcpu.pas
  96. 2 1
      compiler/pp.lpi
  97. 5 0
      compiler/pp.pas
  98. 2 7
      compiler/ppcgen/aasmcpu.pas
  99. 18 1
      compiler/ppcgen/cgppc.pas
  100. 11 13
      compiler/ppu.pas

+ 137 - 35
.gitattributes

@@ -123,11 +123,13 @@ compiler/compinnr.inc svneol=native#text/plain
 compiler/comprsrc.pas svneol=native#text/plain
 compiler/comprsrc.pas svneol=native#text/plain
 compiler/constexp.pas svneol=native#text/x-pascal
 compiler/constexp.pas svneol=native#text/x-pascal
 compiler/cp1251.pas svneol=native#text/plain
 compiler/cp1251.pas svneol=native#text/plain
+compiler/cp1252.pp svneol=native#text/plain
 compiler/cp437.pas svneol=native#text/plain
 compiler/cp437.pas svneol=native#text/plain
 compiler/cp850.pas svneol=native#text/plain
 compiler/cp850.pas svneol=native#text/plain
 compiler/cp866.pas svneol=native#text/plain
 compiler/cp866.pas svneol=native#text/plain
 compiler/cp8859_1.pas svneol=native#text/plain
 compiler/cp8859_1.pas svneol=native#text/plain
 compiler/cp8859_5.pas svneol=native#text/plain
 compiler/cp8859_5.pas svneol=native#text/plain
+compiler/cpid.pas svneol=native#text/plain
 compiler/crefs.pas svneol=native#text/plain
 compiler/crefs.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
@@ -264,8 +266,6 @@ compiler/mips/rmipsdwf.inc svneol=native#text/plain
 compiler/mips/rmipsgas.inc svneol=native#text/plain
 compiler/mips/rmipsgas.inc svneol=native#text/plain
 compiler/mips/rmipsgri.inc svneol=native#text/plain
 compiler/mips/rmipsgri.inc svneol=native#text/plain
 compiler/mips/rmipsgss.inc svneol=native#text/plain
 compiler/mips/rmipsgss.inc svneol=native#text/plain
-compiler/mips/rmipsmot.inc svneol=native#text/plain
-compiler/mips/rmipsmri.inc svneol=native#text/plain
 compiler/mips/rmipsnor.inc svneol=native#text/plain
 compiler/mips/rmipsnor.inc svneol=native#text/plain
 compiler/mips/rmipsnum.inc svneol=native#text/plain
 compiler/mips/rmipsnum.inc svneol=native#text/plain
 compiler/mips/rmipsrni.inc svneol=native#text/plain
 compiler/mips/rmipsrni.inc svneol=native#text/plain
@@ -626,6 +626,7 @@ compiler/x86/nx86cnv.pas svneol=native#text/plain
 compiler/x86/nx86con.pas svneol=native#text/plain
 compiler/x86/nx86con.pas svneol=native#text/plain
 compiler/x86/nx86inl.pas svneol=native#text/plain
 compiler/x86/nx86inl.pas svneol=native#text/plain
 compiler/x86/nx86mat.pas svneol=native#text/plain
 compiler/x86/nx86mat.pas svneol=native#text/plain
+compiler/x86/nx86mem.pas svneol=native#text/plain
 compiler/x86/nx86set.pas svneol=native#text/plain
 compiler/x86/nx86set.pas svneol=native#text/plain
 compiler/x86/rax86.pas svneol=native#text/plain
 compiler/x86/rax86.pas svneol=native#text/plain
 compiler/x86/rax86att.pas svneol=native#text/plain
 compiler/x86/rax86att.pas svneol=native#text/plain
@@ -1980,6 +1981,7 @@ packages/fcl-db/tests/Makefile.fpc -text
 packages/fcl-db/tests/README.txt svneol=native#text/plain
 packages/fcl-db/tests/README.txt svneol=native#text/plain
 packages/fcl-db/tests/XMLXSDExportTest.lpi svneol=native#text/plain
 packages/fcl-db/tests/XMLXSDExportTest.lpi svneol=native#text/plain
 packages/fcl-db/tests/XMLXSDExportTest.lpr svneol=native#text/plain
 packages/fcl-db/tests/XMLXSDExportTest.lpr svneol=native#text/plain
+packages/fcl-db/tests/bufdatasettoolsunit.pas svneol=native#text/plain
 packages/fcl-db/tests/database.ini.txt svneol=native#text/plain
 packages/fcl-db/tests/database.ini.txt svneol=native#text/plain
 packages/fcl-db/tests/dbfexporttest.lpi svneol=native#text/plain
 packages/fcl-db/tests/dbfexporttest.lpi svneol=native#text/plain
 packages/fcl-db/tests/dbfexporttest.lpr svneol=native#text/plain
 packages/fcl-db/tests/dbfexporttest.lpr svneol=native#text/plain
@@ -2772,39 +2774,6 @@ packages/fppkg/src/pkgmkconv.pp svneol=native#text/plain
 packages/fppkg/src/pkgoptions.pp svneol=native#text/plain
 packages/fppkg/src/pkgoptions.pp svneol=native#text/plain
 packages/fppkg/src/pkgrepos.pp svneol=native#text/plain
 packages/fppkg/src/pkgrepos.pp svneol=native#text/plain
 packages/fppkg/src/pkgwget.pp svneol=native#text/plain
 packages/fppkg/src/pkgwget.pp svneol=native#text/plain
-packages/fpvectorial/Makefile svneol=native#text/plain
-packages/fpvectorial/Makefile.fpc svneol=native#text/plain
-packages/fpvectorial/examples/fpce_mainform.lfm svneol=native#text/plain
-packages/fpvectorial/examples/fpce_mainform.pas svneol=native#text/plain
-packages/fpvectorial/examples/fpcorelexplorer.ico -text
-packages/fpvectorial/examples/fpcorelexplorer.lpi svneol=native#text/plain
-packages/fpvectorial/examples/fpcorelexplorer.lpr svneol=native#text/plain
-packages/fpvectorial/examples/fpvc_mainform.lfm svneol=native#text/plain
-packages/fpvectorial/examples/fpvc_mainform.pas svneol=native#text/plain
-packages/fpvectorial/examples/fpvectorialconverter.ico -text
-packages/fpvectorial/examples/fpvectorialconverter.lpi svneol=native#text/plain
-packages/fpvectorial/examples/fpvectorialconverter.lpr svneol=native#text/plain
-packages/fpvectorial/examples/fpvmodifytest.lpi svneol=native#text/plain
-packages/fpvectorial/examples/fpvmodifytest.pas svneol=native#text/plain
-packages/fpvectorial/examples/fpvwritetest.lpi svneol=native#text/plain
-packages/fpvectorial/examples/fpvwritetest.pas svneol=native#text/plain
-packages/fpvectorial/fpmake.pp svneol=native#text/plain
-packages/fpvectorial/src/avisocncgcodereader.pas svneol=native#text/pascal
-packages/fpvectorial/src/avisocncgcodewriter.pas svneol=native#text/pascal
-packages/fpvectorial/src/avisozlib.pas svneol=native#text/pascal
-packages/fpvectorial/src/cdrvectorialreader.pas svneol=native#text/pascal
-packages/fpvectorial/src/dxfvectorialreader.pas svneol=native#text/pascal
-packages/fpvectorial/src/epsvectorialreader.pas svneol=native#text/pascal
-packages/fpvectorial/src/fpvectbuildunit.pas svneol=native#text/pascal
-packages/fpvectorial/src/fpvectorial.pas svneol=native#text/pascal
-packages/fpvectorial/src/fpvtocanvas.pas svneol=native#text/pascal
-packages/fpvectorial/src/fpvutils.pas svneol=native#text/pascal
-packages/fpvectorial/src/pdfvectorialreader.pas svneol=native#text/pascal
-packages/fpvectorial/src/pdfvrlexico.pas svneol=native#text/pascal
-packages/fpvectorial/src/pdfvrsemantico.pas svneol=native#text/pascal
-packages/fpvectorial/src/pdfvrsintatico.pas svneol=native#text/pascal
-packages/fpvectorial/src/svgvectorialreader.pas svneol=native#text/pascal
-packages/fpvectorial/src/svgvectorialwriter.pas svneol=native#text/pascal
 packages/fuse/Makefile svneol=native#text/plain
 packages/fuse/Makefile svneol=native#text/plain
 packages/fuse/Makefile.fpc svneol=native#text/plain
 packages/fuse/Makefile.fpc svneol=native#text/plain
 packages/fuse/fpmake_disabled.pp svneol=native#text/plain
 packages/fuse/fpmake_disabled.pp svneol=native#text/plain
@@ -5564,6 +5533,7 @@ packages/paszlib/Makefile.fpc svneol=native#text/plain
 packages/paszlib/examples/Makefile svneol=native#text/plain
 packages/paszlib/examples/Makefile svneol=native#text/plain
 packages/paszlib/examples/Makefile.fpc svneol=native#text/plain
 packages/paszlib/examples/Makefile.fpc svneol=native#text/plain
 packages/paszlib/examples/example.pas svneol=native#text/plain
 packages/paszlib/examples/example.pas svneol=native#text/plain
+packages/paszlib/examples/example2.pas svneol=native#text/plain
 packages/paszlib/examples/extractodt.pas svneol=native#text/plain
 packages/paszlib/examples/extractodt.pas svneol=native#text/plain
 packages/paszlib/examples/minigzip.pas svneol=native#text/plain
 packages/paszlib/examples/minigzip.pas svneol=native#text/plain
 packages/paszlib/examples/miniunz.pas svneol=native#text/plain
 packages/paszlib/examples/miniunz.pas svneol=native#text/plain
@@ -5620,6 +5590,8 @@ packages/ptc/Makefile.fpc svneol=native#text/plain
 packages/ptc/docs/AUTHORS.txt svneol=native#text/plain
 packages/ptc/docs/AUTHORS.txt svneol=native#text/plain
 packages/ptc/docs/CHANGES.txt svneol=native#text/plain
 packages/ptc/docs/CHANGES.txt svneol=native#text/plain
 packages/ptc/docs/INSTALL.txt svneol=native#text/plain
 packages/ptc/docs/INSTALL.txt svneol=native#text/plain
+packages/ptc/docs/INTF-CHANGES-0.99.12.txt svneol=native#text/plain
+packages/ptc/docs/INTF-CHANGES-FAQ-0.99.12.txt svneol=native#text/plain
 packages/ptc/docs/INTRO.txt svneol=native#text/plain
 packages/ptc/docs/INTRO.txt svneol=native#text/plain
 packages/ptc/docs/README.txt svneol=native#text/plain
 packages/ptc/docs/README.txt svneol=native#text/plain
 packages/ptc/docs/TODO.txt svneol=native#text/plain
 packages/ptc/docs/TODO.txt svneol=native#text/plain
@@ -6762,6 +6734,7 @@ packages/winunits-jedi/src/jwawsrm.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwawsvns.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwawsvns.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwawtsapi32.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwawtsapi32.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwazmouse.pas svneol=native#text/plain
 packages/winunits-jedi/src/jwazmouse.pas svneol=native#text/plain
+packages/winunits-jedi/tests/tjwapsapi1.pp svneol=native#text/pascal
 packages/x11/Makefile svneol=native#text/plain
 packages/x11/Makefile svneol=native#text/plain
 packages/x11/Makefile.fpc svneol=native#text/plain
 packages/x11/Makefile.fpc svneol=native#text/plain
 packages/x11/fpmake.pp svneol=native#text/plain
 packages/x11/fpmake.pp svneol=native#text/plain
@@ -7032,7 +7005,9 @@ rtl/embedded/avr/start.inc svneol=native#text/plain
 rtl/embedded/buildrtl.lpi svneol=native#text/plain
 rtl/embedded/buildrtl.lpi svneol=native#text/plain
 rtl/embedded/buildrtl.pp svneol=native#text/plain
 rtl/embedded/buildrtl.pp svneol=native#text/plain
 rtl/embedded/check.inc svneol=native#text/plain
 rtl/embedded/check.inc svneol=native#text/plain
+rtl/embedded/consoleio.pp svneol=native#text/pascal
 rtl/embedded/empty.cfg svneol=native#text/plain
 rtl/embedded/empty.cfg svneol=native#text/plain
+rtl/embedded/heapmgr.pp svneol=native#text/pascal
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/rtl.cfg svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysdir.inc svneol=native#text/plain
 rtl/embedded/sysfile.inc svneol=native#text/plain
 rtl/embedded/sysfile.inc svneol=native#text/plain
@@ -7072,6 +7047,7 @@ rtl/freebsd/errnostr.inc svneol=native#text/plain
 rtl/freebsd/freebsd.pas -text svneol=unset#text/plain
 rtl/freebsd/freebsd.pas -text svneol=unset#text/plain
 rtl/freebsd/i386/bsyscall.inc svneol=native#text/plain
 rtl/freebsd/i386/bsyscall.inc svneol=native#text/plain
 rtl/freebsd/i386/cprt0.as svneol=native#text/plain
 rtl/freebsd/i386/cprt0.as svneol=native#text/plain
+rtl/freebsd/i386/dllprt0.as svneol=native#text/plain
 rtl/freebsd/i386/gprt0.as svneol=native#text/plain
 rtl/freebsd/i386/gprt0.as svneol=native#text/plain
 rtl/freebsd/i386/identpatch.sh svneol=native#text/plain
 rtl/freebsd/i386/identpatch.sh svneol=native#text/plain
 rtl/freebsd/i386/prt0.as svneol=native#text/plain
 rtl/freebsd/i386/prt0.as svneol=native#text/plain
@@ -7099,6 +7075,7 @@ rtl/freebsd/unxsockh.inc svneol=native#text/plain
 rtl/freebsd/unxsysc.inc svneol=native#text/plain
 rtl/freebsd/unxsysc.inc svneol=native#text/plain
 rtl/freebsd/x86_64/bsyscall.inc svneol=native#text/plain
 rtl/freebsd/x86_64/bsyscall.inc svneol=native#text/plain
 rtl/freebsd/x86_64/cprt0.as svneol=native#text/plain
 rtl/freebsd/x86_64/cprt0.as svneol=native#text/plain
+rtl/freebsd/x86_64/dllprt0.as svneol=native#text/plain
 rtl/freebsd/x86_64/gprt0.as svneol=native#text/plain
 rtl/freebsd/x86_64/gprt0.as svneol=native#text/plain
 rtl/freebsd/x86_64/prt0.as svneol=native#text/plain
 rtl/freebsd/x86_64/prt0.as svneol=native#text/plain
 rtl/freebsd/x86_64/si_c.inc svneol=native#text/plain
 rtl/freebsd/x86_64/si_c.inc svneol=native#text/plain
@@ -7742,6 +7719,7 @@ rtl/netwlibc/winsock.pp svneol=native#text/plain
 rtl/netwlibc/ws2_32.imp -text
 rtl/netwlibc/ws2_32.imp -text
 rtl/netwlibc/ws2nlm.imp -text
 rtl/netwlibc/ws2nlm.imp -text
 rtl/objpas/README.txt svneol=native#text/plain
 rtl/objpas/README.txt svneol=native#text/plain
+rtl/objpas/character.pas svneol=native#text/pascal
 rtl/objpas/classes/action.inc svneol=native#text/plain
 rtl/objpas/classes/action.inc svneol=native#text/plain
 rtl/objpas/classes/bits.inc svneol=native#text/plain
 rtl/objpas/classes/bits.inc svneol=native#text/plain
 rtl/objpas/classes/classes.inc svneol=native#text/plain
 rtl/objpas/classes/classes.inc svneol=native#text/plain
@@ -7796,6 +7774,10 @@ rtl/objpas/sysutils/stre.inc svneol=native#text/plain
 rtl/objpas/sysutils/strg.inc svneol=native#text/plain
 rtl/objpas/sysutils/strg.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysansi.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysansi.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysansih.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysansih.inc svneol=native#text/plain
+rtl/objpas/sysutils/syscodepages.inc svneol=native#text/pascal
+rtl/objpas/sysutils/syscodepagesh.inc svneol=native#text/pascal
+rtl/objpas/sysutils/sysencoding.inc svneol=native#text/pascal
+rtl/objpas/sysutils/sysencodingh.inc svneol=native#text/pascal
 rtl/objpas/sysutils/sysformt.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysformt.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysint.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysint.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysinth.inc svneol=native#text/plain
 rtl/objpas/sysutils/sysinth.inc svneol=native#text/plain
@@ -7814,18 +7796,24 @@ rtl/objpas/sysutils/syswide.inc svneol=native#text/plain
 rtl/objpas/sysutils/syswideh.inc svneol=native#text/plain
 rtl/objpas/sysutils/syswideh.inc svneol=native#text/plain
 rtl/objpas/types.pp svneol=native#text/plain
 rtl/objpas/types.pp svneol=native#text/plain
 rtl/objpas/typinfo.pp svneol=native#text/plain
 rtl/objpas/typinfo.pp svneol=native#text/plain
+rtl/objpas/unicodedata.inc svneol=native#text/pascal
+rtl/objpas/unicodedata2.inc svneol=native#text/pascal
 rtl/objpas/utf8bidi.pp svneol=native#text/plain
 rtl/objpas/utf8bidi.pp svneol=native#text/plain
 rtl/objpas/varutilh.inc svneol=native#text/plain
 rtl/objpas/varutilh.inc svneol=native#text/plain
 rtl/objpas/varutils.inc svneol=native#text/plain
 rtl/objpas/varutils.inc svneol=native#text/plain
 rtl/openbsd/Makefile svneol=native#text/plain
 rtl/openbsd/Makefile svneol=native#text/plain
 rtl/openbsd/Makefile.fpc svneol=native#text/plain
 rtl/openbsd/Makefile.fpc svneol=native#text/plain
+rtl/openbsd/check_sys.sh svneol=native#text/plain
 rtl/openbsd/classes.pp svneol=native#text/plain
 rtl/openbsd/classes.pp svneol=native#text/plain
 rtl/openbsd/errno.inc svneol=native#text/plain
 rtl/openbsd/errno.inc svneol=native#text/plain
 rtl/openbsd/errnostr.inc svneol=native#text/plain
 rtl/openbsd/errnostr.inc svneol=native#text/plain
+rtl/openbsd/i386/bsyscall.inc svneol=native#text/plain
 rtl/openbsd/i386/cprt0.as svneol=native#text/plain
 rtl/openbsd/i386/cprt0.as svneol=native#text/plain
 rtl/openbsd/i386/prt0.as svneol=native#text/plain
 rtl/openbsd/i386/prt0.as svneol=native#text/plain
 rtl/openbsd/i386/sighnd.inc svneol=native#text/plain
 rtl/openbsd/i386/sighnd.inc svneol=native#text/plain
+rtl/openbsd/osdefs.inc svneol=native#text/plain
 rtl/openbsd/pmutext.inc svneol=native#text/plain
 rtl/openbsd/pmutext.inc svneol=native#text/plain
+rtl/openbsd/pthread.inc -text svneol=unset#test/plain
 rtl/openbsd/ptypes.inc svneol=native#text/plain
 rtl/openbsd/ptypes.inc svneol=native#text/plain
 rtl/openbsd/signal.inc svneol=native#text/plain
 rtl/openbsd/signal.inc svneol=native#text/plain
 rtl/openbsd/syscalls.inc svneol=native#text/plain
 rtl/openbsd/syscalls.inc svneol=native#text/plain
@@ -7839,7 +7827,10 @@ rtl/openbsd/termios.inc svneol=native#text/plain
 rtl/openbsd/termiosproc.inc svneol=native#text/plain
 rtl/openbsd/termiosproc.inc svneol=native#text/plain
 rtl/openbsd/unixsock.inc svneol=native#text/plain
 rtl/openbsd/unixsock.inc svneol=native#text/plain
 rtl/openbsd/unixsysc.inc svneol=native#text/plain
 rtl/openbsd/unixsysc.inc svneol=native#text/plain
+rtl/openbsd/unxconst.inc svneol=native#text/plain
+rtl/openbsd/unxfunc.inc svneol=native#text/plain
 rtl/openbsd/unxsockh.inc svneol=native#text/plain
 rtl/openbsd/unxsockh.inc svneol=native#text/plain
+rtl/openbsd/unxsysc.inc svneol=native#text/plain
 rtl/os2/Makefile svneol=native#text/plain
 rtl/os2/Makefile svneol=native#text/plain
 rtl/os2/Makefile.fpc svneol=native#text/plain
 rtl/os2/Makefile.fpc svneol=native#text/plain
 rtl/os2/classes.pp svneol=native#text/plain
 rtl/os2/classes.pp svneol=native#text/plain
@@ -8119,6 +8110,7 @@ rtl/unix/unxovl.inc svneol=native#text/plain
 rtl/unix/unxovlh.inc svneol=native#text/plain
 rtl/unix/unxovlh.inc svneol=native#text/plain
 rtl/unix/varutils.pp svneol=native#text/plain
 rtl/unix/varutils.pp svneol=native#text/plain
 rtl/unix/video.pp svneol=native#text/plain
 rtl/unix/video.pp svneol=native#text/plain
+rtl/unix/winiconv.inc svneol=native#text/plain
 rtl/unix/x86.pp svneol=native#text/plain
 rtl/unix/x86.pp svneol=native#text/plain
 rtl/watcom/Makefile svneol=native#text/plain
 rtl/watcom/Makefile svneol=native#text/plain
 rtl/watcom/Makefile.fpc svneol=native#text/plain
 rtl/watcom/Makefile.fpc svneol=native#text/plain
@@ -8578,6 +8570,7 @@ tests/tbf/tb0218.pp svneol=native#text/plain
 tests/tbf/tb0219.pp svneol=native#text/pascal
 tests/tbf/tb0219.pp svneol=native#text/pascal
 tests/tbf/tb0220.pp svneol=native#text/plain
 tests/tbf/tb0220.pp svneol=native#text/plain
 tests/tbf/tb0221.pp svneol=native#text/plain
 tests/tbf/tb0221.pp svneol=native#text/plain
+tests/tbf/tb0222.pp svneol=native#text/plain
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain
@@ -9260,10 +9253,13 @@ tests/test/cg/obj/freebsd/i386/ctest.o -text
 tests/test/cg/obj/freebsd/i386/tcext3.o -text
 tests/test/cg/obj/freebsd/i386/tcext3.o -text
 tests/test/cg/obj/freebsd/i386/tcext4.o -text
 tests/test/cg/obj/freebsd/i386/tcext4.o -text
 tests/test/cg/obj/freebsd/i386/tcext5.o -text
 tests/test/cg/obj/freebsd/i386/tcext5.o -text
+tests/test/cg/obj/freebsd/x86_64/cpptcl1.o -text
+tests/test/cg/obj/freebsd/x86_64/cpptcl2.o -text
 tests/test/cg/obj/freebsd/x86_64/ctest.o -text
 tests/test/cg/obj/freebsd/x86_64/ctest.o -text
 tests/test/cg/obj/freebsd/x86_64/tcext3.o -text
 tests/test/cg/obj/freebsd/x86_64/tcext3.o -text
 tests/test/cg/obj/freebsd/x86_64/tcext4.o -text
 tests/test/cg/obj/freebsd/x86_64/tcext4.o -text
 tests/test/cg/obj/freebsd/x86_64/tcext5.o -text
 tests/test/cg/obj/freebsd/x86_64/tcext5.o -text
+tests/test/cg/obj/freebsd/x86_64/tcext6.o -text
 tests/test/cg/obj/go32v2/i386/cpptcl1.o -text
 tests/test/cg/obj/go32v2/i386/cpptcl1.o -text
 tests/test/cg/obj/go32v2/i386/cpptcl2.o -text
 tests/test/cg/obj/go32v2/i386/cpptcl2.o -text
 tests/test/cg/obj/go32v2/i386/ctest.o -text
 tests/test/cg/obj/go32v2/i386/ctest.o -text
@@ -9321,6 +9317,13 @@ tests/test/cg/obj/linux/x86_64/tcext5.o -text
 tests/test/cg/obj/linux/x86_64/tcext6.o -text
 tests/test/cg/obj/linux/x86_64/tcext6.o -text
 tests/test/cg/obj/macos/powerpc/ctest.o -text
 tests/test/cg/obj/macos/powerpc/ctest.o -text
 tests/test/cg/obj/netbsd/m68k/ctest.o -text
 tests/test/cg/obj/netbsd/m68k/ctest.o -text
+tests/test/cg/obj/openbsd/i386/cpptcl1.o -text
+tests/test/cg/obj/openbsd/i386/cpptcl2.o -text
+tests/test/cg/obj/openbsd/i386/ctest.o -text
+tests/test/cg/obj/openbsd/i386/tcext3.o -text
+tests/test/cg/obj/openbsd/i386/tcext4.o -text
+tests/test/cg/obj/openbsd/i386/tcext5.o -text
+tests/test/cg/obj/openbsd/i386/tcext6.o -text
 tests/test/cg/obj/os2/i386/ctest.o -text
 tests/test/cg/obj/os2/i386/ctest.o -text
 tests/test/cg/obj/readme.txt svneol=native#text/plain
 tests/test/cg/obj/readme.txt svneol=native#text/plain
 tests/test/cg/obj/solaris/i386/cpptcl1.o -text
 tests/test/cg/obj/solaris/i386/cpptcl1.o -text
@@ -9936,6 +9939,44 @@ tests/test/tconstref1.pp svneol=native#text/pascal
 tests/test/tconstref2.pp svneol=native#text/pascal
 tests/test/tconstref2.pp svneol=native#text/pascal
 tests/test/tconstref3.pp svneol=native#text/pascal
 tests/test/tconstref3.pp svneol=native#text/pascal
 tests/test/tconstref4.pp svneol=native#text/pascal
 tests/test/tconstref4.pp svneol=native#text/pascal
+tests/test/tcpstr1.pp svneol=native#text/plain
+tests/test/tcpstr10.pp svneol=native#text/pascal
+tests/test/tcpstr11.pp svneol=native#text/pascal
+tests/test/tcpstr12.pp svneol=native#text/pascal
+tests/test/tcpstr13.pp svneol=native#text/pascal
+tests/test/tcpstr14.pp svneol=native#text/pascal
+tests/test/tcpstr15.pp svneol=native#text/pascal
+tests/test/tcpstr16.pp svneol=native#text/pascal
+tests/test/tcpstr17.pp svneol=native#text/pascal
+tests/test/tcpstr18.pp svneol=native#text/pascal
+tests/test/tcpstr2.pp svneol=native#text/plain
+tests/test/tcpstr2a.pp svneol=native#text/plain
+tests/test/tcpstr3.pp svneol=native#text/plain
+tests/test/tcpstr4.pp svneol=native#text/plain
+tests/test/tcpstr5.pp svneol=native#text/plain
+tests/test/tcpstr6.pp svneol=native#text/plain
+tests/test/tcpstr7.pp svneol=native#text/plain
+tests/test/tcpstr8.pp svneol=native#text/pascal
+tests/test/tcpstr9.pp svneol=native#text/pascal
+tests/test/tcpstransistr2shortstring.pp svneol=native#text/plain
+tests/test/tcpstransistr2widechararray.pp svneol=native#text/plain
+tests/test/tcpstransistrcompare.pp svneol=native#text/plain
+tests/test/tcpstransistrcompareequal.pp svneol=native#text/plain
+tests/test/tcpstransistrcopy.pp svneol=native#text/plain
+tests/test/tcpstrassignansistr.pp svneol=native#text/plain
+tests/test/tcpstrchar2ansistr.pp svneol=native#text/plain
+tests/test/tcpstrconcat.pp svneol=native#text/plain
+tests/test/tcpstrconcat2.pp svneol=native#text/plain
+tests/test/tcpstrconcat3.pp svneol=native#text/plain
+tests/test/tcpstrconcatmulti.pp svneol=native#text/plain
+tests/test/tcpstrconcatmulti2.pp svneol=native#text/plain
+tests/test/tcpstrpchar2ansistr.pp svneol=native#text/plain
+tests/test/tcpstrsetlength.pp svneol=native#text/plain
+tests/test/tcpstrsetlength2.pp svneol=native#text/plain
+tests/test/tcpstrshortstr2ansistr.pp svneol=native#text/plain
+tests/test/tcptypedconst.pp svneol=native#text/plain
+tests/test/tcptypedconst2.pp svneol=native#text/plain
+tests/test/tcptypedconst3.pp svneol=native#text/plain
 tests/test/tcstring1.pp svneol=native#text/pascal
 tests/test/tcstring1.pp svneol=native#text/pascal
 tests/test/tcstring2.pp svneol=native#text/pascal
 tests/test/tcstring2.pp svneol=native#text/pascal
 tests/test/tdel1.pp svneol=native#text/plain
 tests/test/tdel1.pp svneol=native#text/plain
@@ -10522,6 +10563,7 @@ tests/test/tsubdecl.pp svneol=native#text/plain
 tests/test/tsymlibrary1.pp svneol=native#text/pascal
 tests/test/tsymlibrary1.pp svneol=native#text/pascal
 tests/test/ttpara1.pp svneol=native#text/plain
 tests/test/ttpara1.pp svneol=native#text/plain
 tests/test/ttpara2.pp svneol=native#text/plain
 tests/test/ttpara2.pp svneol=native#text/plain
+tests/test/ttypeconvtypes.pp svneol=native#text/pascal
 tests/test/ttypedarray1.pp svneol=native#text/pascal
 tests/test/ttypedarray1.pp svneol=native#text/pascal
 tests/test/ttypedrecord1.pp svneol=native#text/plain
 tests/test/ttypedrecord1.pp svneol=native#text/plain
 tests/test/ttypedrecord2.pp svneol=native#text/plain
 tests/test/ttypedrecord2.pp svneol=native#text/plain
@@ -10534,6 +10576,7 @@ tests/test/tunistr4.pp svneol=native#text/plain
 tests/test/tunistr5.pp svneol=native#text/plain
 tests/test/tunistr5.pp svneol=native#text/plain
 tests/test/tunistr6.pp svneol=native#text/plain
 tests/test/tunistr6.pp svneol=native#text/plain
 tests/test/tunistr7.pp svneol=native#text/plain
 tests/test/tunistr7.pp svneol=native#text/plain
+tests/test/tunistrcopy.pp svneol=native#text/plain
 tests/test/tunit1.pp svneol=native#text/plain
 tests/test/tunit1.pp svneol=native#text/plain
 tests/test/tunit2.pp svneol=native#text/plain
 tests/test/tunit2.pp svneol=native#text/plain
 tests/test/tunit3.pp svneol=native#text/plain
 tests/test/tunit3.pp svneol=native#text/plain
@@ -10594,6 +10637,43 @@ tests/test/ulib2a.pp svneol=native#text/plain
 tests/test/umaclocalprocparam3f.pp svneol=native#text/plain
 tests/test/umaclocalprocparam3f.pp svneol=native#text/plain
 tests/test/umacpas1.pp svneol=native#text/plain
 tests/test/umacpas1.pp svneol=native#text/plain
 tests/test/umainnam.pp svneol=native#text/plain
 tests/test/umainnam.pp svneol=native#text/plain
+tests/test/units/character/tgetnumericvalue.pp svneol=native#text/pascal
+tests/test/units/character/tgetnumericvalue2.pp svneol=native#text/pascal
+tests/test/units/character/tgetnumericvalue3.pp svneol=native#text/pascal
+tests/test/units/character/tgetunicodecategoriesurro.pp svneol=native#text/pascal
+tests/test/units/character/tiscontrol.pp svneol=native#text/pascal
+tests/test/units/character/tiscontrol2.pp svneol=native#text/pascal
+tests/test/units/character/tiscontrol3.pp svneol=native#text/pascal
+tests/test/units/character/tisdigit.pp svneol=native#text/pascal
+tests/test/units/character/tisdigit2.pp svneol=native#text/pascal
+tests/test/units/character/tisdigit3.pp svneol=native#text/pascal
+tests/test/units/character/tishighsurrogate.pp svneol=native#text/pascal
+tests/test/units/character/tisletter.pp svneol=native#text/pascal
+tests/test/units/character/tisletter2.pp svneol=native#text/pascal
+tests/test/units/character/tisletterordigit.pp svneol=native#text/pascal
+tests/test/units/character/tisletterordigit2.pp svneol=native#text/pascal
+tests/test/units/character/tislower2.pp svneol=native#text/pascal
+tests/test/units/character/tislowsurrogate.pp svneol=native#text/pascal
+tests/test/units/character/tisnumber.pp svneol=native#text/pascal
+tests/test/units/character/tisnumber2.pp svneol=native#text/pascal
+tests/test/units/character/tispunctuation.pp svneol=native#text/pascal
+tests/test/units/character/tisseparator.pp svneol=native#text/pascal
+tests/test/units/character/tissurrogate.pp svneol=native#text/pascal
+tests/test/units/character/tissurrogatepair.pp svneol=native#text/pascal
+tests/test/units/character/tissurrogatepair2.pp svneol=native#text/pascal
+tests/test/units/character/tissymbol.pp svneol=native#text/pascal
+tests/test/units/character/tisupper.pp svneol=native#text/pascal
+tests/test/units/character/tiswhitespace.pp svneol=native#text/pascal
+tests/test/units/character/tlowercase.pp svneol=native#text/pascal
+tests/test/units/character/tlowercase2.pp svneol=native#text/pascal
+tests/test/units/character/ttolower.pp svneol=native#text/pascal
+tests/test/units/character/ttolower2.pp svneol=native#text/pascal
+tests/test/units/character/ttolower3.pp svneol=native#text/pascal
+tests/test/units/character/ttoupper.pp svneol=native#text/pascal
+tests/test/units/character/ttoupper2.pp svneol=native#text/pascal
+tests/test/units/character/ttoupper3.pp svneol=native#text/pascal
+tests/test/units/character/tutf32convert.pp svneol=native#text/pascal
+tests/test/units/classes/tbytesstreamtest.pp svneol=native#text/pascal
 tests/test/units/classes/tmakeobjinst.pp svneol=native#text/plain
 tests/test/units/classes/tmakeobjinst.pp svneol=native#text/plain
 tests/test/units/classes/tsetstream.pp svneol=native#text/plain
 tests/test/units/classes/tsetstream.pp svneol=native#text/plain
 tests/test/units/classes/tvclcomobject.pp svneol=native#text/plain
 tests/test/units/classes/tvclcomobject.pp svneol=native#text/plain
@@ -10612,6 +10692,7 @@ tests/test/units/dos/tidos.pp svneol=native#text/plain
 tests/test/units/dos/tidos2.pp svneol=native#text/plain
 tests/test/units/dos/tidos2.pp svneol=native#text/plain
 tests/test/units/dos/tverify.pp svneol=native#text/plain
 tests/test/units/dos/tverify.pp svneol=native#text/plain
 tests/test/units/dos/tversion.pp svneol=native#text/plain
 tests/test/units/dos/tversion.pp svneol=native#text/plain
+tests/test/units/fmtbcd/tfmtbcd.pp svneol=native#text/plain
 tests/test/units/fpcunit/fplists.pp svneol=native#text/plain
 tests/test/units/fpcunit/fplists.pp svneol=native#text/plain
 tests/test/units/fpcunit/gencomptest.dpr svneol=native#text/plain
 tests/test/units/fpcunit/gencomptest.dpr svneol=native#text/plain
 tests/test/units/fpcunit/lists.pp svneol=native#text/plain
 tests/test/units/fpcunit/lists.pp svneol=native#text/plain
@@ -10722,7 +10803,10 @@ tests/test/units/system/tvalc.pp svneol=native#text/plain
 tests/test/units/sysutils/strtotimetest.pp svneol=native#text/plain
 tests/test/units/sysutils/strtotimetest.pp svneol=native#text/plain
 tests/test/units/sysutils/tastrcmp.pp svneol=native#text/plain
 tests/test/units/sysutils/tastrcmp.pp svneol=native#text/plain
 tests/test/units/sysutils/tastrcmp1.pp svneol=native#text/plain
 tests/test/units/sysutils/tastrcmp1.pp svneol=native#text/plain
+tests/test/units/sysutils/tbytesof.pp svneol=native#text/pascal
 tests/test/units/sysutils/tdirex.pp svneol=native#text/plain
 tests/test/units/sysutils/tdirex.pp svneol=native#text/plain
+tests/test/units/sysutils/tencodingerrors.pp svneol=native#text/pascal
+tests/test/units/sysutils/tencodingtest.pp svneol=native#text/pascal
 tests/test/units/sysutils/texec1.pp svneol=native#text/plain
 tests/test/units/sysutils/texec1.pp svneol=native#text/plain
 tests/test/units/sysutils/texec2.pp svneol=native#text/plain
 tests/test/units/sysutils/texec2.pp svneol=native#text/plain
 tests/test/units/sysutils/textractquote.pp svneol=native#text/plain
 tests/test/units/sysutils/textractquote.pp svneol=native#text/plain
@@ -10922,6 +11006,7 @@ tests/webtbf/tw1842.pp svneol=native#text/plain
 tests/webtbf/tw1858.pp svneol=native#text/plain
 tests/webtbf/tw1858.pp svneol=native#text/plain
 tests/webtbf/tw18620.pp svneol=native#text/pascal
 tests/webtbf/tw18620.pp svneol=native#text/pascal
 tests/webtbf/tw1905.pp svneol=native#text/plain
 tests/webtbf/tw1905.pp svneol=native#text/plain
+tests/webtbf/tw19213.pp svneol=native#text/plain
 tests/webtbf/tw1927.pp svneol=native#text/plain
 tests/webtbf/tw1927.pp svneol=native#text/plain
 tests/webtbf/tw1928.pp svneol=native#text/plain
 tests/webtbf/tw1928.pp svneol=native#text/plain
 tests/webtbf/tw1939.pp svneol=native#text/plain
 tests/webtbf/tw1939.pp svneol=native#text/plain
@@ -10930,11 +11015,15 @@ tests/webtbf/tw1949.pp svneol=native#text/plain
 tests/webtbf/tw19591.pp svneol=native#text/plain
 tests/webtbf/tw19591.pp svneol=native#text/plain
 tests/webtbf/tw1969.pp svneol=native#text/plain
 tests/webtbf/tw1969.pp svneol=native#text/plain
 tests/webtbf/tw1995.pp svneol=native#text/plain
 tests/webtbf/tw1995.pp svneol=native#text/plain
+tests/webtbf/tw19975.pp svneol=native#text/pascal
+tests/webtbf/tw20095.pp svneol=native#text/plain
 tests/webtbf/tw2018.pp svneol=native#text/plain
 tests/webtbf/tw2018.pp svneol=native#text/plain
 tests/webtbf/tw2037.pp svneol=native#text/plain
 tests/webtbf/tw2037.pp svneol=native#text/plain
 tests/webtbf/tw2046.pp svneol=native#text/plain
 tests/webtbf/tw2046.pp svneol=native#text/plain
 tests/webtbf/tw2053.pp svneol=native#text/plain
 tests/webtbf/tw2053.pp svneol=native#text/plain
 tests/webtbf/tw2053b.pp svneol=native#text/plain
 tests/webtbf/tw2053b.pp svneol=native#text/plain
+tests/webtbf/tw20580.pp svneol=native#text/pascal
+tests/webtbf/tw20661.pp svneol=native#text/plain
 tests/webtbf/tw2070.pp svneol=native#text/plain
 tests/webtbf/tw2070.pp svneol=native#text/plain
 tests/webtbf/tw2128.pp svneol=native#text/plain
 tests/webtbf/tw2128.pp svneol=native#text/plain
 tests/webtbf/tw2129.pp svneol=native#text/plain
 tests/webtbf/tw2129.pp svneol=native#text/plain
@@ -11692,6 +11781,7 @@ tests/webtbs/tw17646.pp svneol=native#text/plain
 tests/webtbs/tw1765.pp svneol=native#text/plain
 tests/webtbs/tw1765.pp svneol=native#text/plain
 tests/webtbs/tw17675.pp svneol=native#text/plain
 tests/webtbs/tw17675.pp svneol=native#text/plain
 tests/webtbs/tw17675a.pp svneol=native#text/plain
 tests/webtbs/tw17675a.pp svneol=native#text/plain
+tests/webtbs/tw17685.pp svneol=native#text/pascal
 tests/webtbs/tw17710.pp svneol=native#text/pascal
 tests/webtbs/tw17710.pp svneol=native#text/pascal
 tests/webtbs/tw17714.pp svneol=native#text/plain
 tests/webtbs/tw17714.pp svneol=native#text/plain
 tests/webtbs/tw17715.pp svneol=native#text/plain
 tests/webtbs/tw17715.pp svneol=native#text/plain
@@ -11765,6 +11855,7 @@ tests/webtbs/tw1909.pp svneol=native#text/plain
 tests/webtbs/tw1910.pp svneol=native#text/plain
 tests/webtbs/tw1910.pp svneol=native#text/plain
 tests/webtbs/tw1915.pp svneol=native#text/plain
 tests/webtbs/tw1915.pp svneol=native#text/plain
 tests/webtbs/tw1917.pp svneol=native#text/plain
 tests/webtbs/tw1917.pp svneol=native#text/plain
+tests/webtbs/tw19180.pp svneol=native#text/plain
 tests/webtbs/tw19182.pp svneol=native#text/plain
 tests/webtbs/tw19182.pp svneol=native#text/plain
 tests/webtbs/tw1920.pp svneol=native#text/plain
 tests/webtbs/tw1920.pp svneol=native#text/plain
 tests/webtbs/tw19201.pp svneol=native#text/pascal
 tests/webtbs/tw19201.pp svneol=native#text/pascal
@@ -11776,6 +11867,7 @@ tests/webtbs/tw1932.pp svneol=native#text/plain
 tests/webtbs/tw19325.pp svneol=native#text/pascal
 tests/webtbs/tw19325.pp svneol=native#text/pascal
 tests/webtbs/tw1935.pp svneol=native#text/plain
 tests/webtbs/tw1935.pp svneol=native#text/plain
 tests/webtbs/tw1936.pp svneol=native#text/plain
 tests/webtbs/tw1936.pp svneol=native#text/plain
+tests/webtbs/tw19368.pp svneol=native#text/pascal
 tests/webtbs/tw1938.pp svneol=native#text/plain
 tests/webtbs/tw1938.pp svneol=native#text/plain
 tests/webtbs/tw1948.pp svneol=native#text/plain
 tests/webtbs/tw1948.pp svneol=native#text/plain
 tests/webtbs/tw1950.pp svneol=native#text/plain
 tests/webtbs/tw1950.pp svneol=native#text/plain
@@ -11797,25 +11889,35 @@ tests/webtbs/tw20003.pp svneol=native#text/pascal
 tests/webtbs/tw20005.pp svneol=native#text/pascal
 tests/webtbs/tw20005.pp svneol=native#text/pascal
 tests/webtbs/tw2001.pp svneol=native#text/plain
 tests/webtbs/tw2001.pp svneol=native#text/plain
 tests/webtbs/tw2002.pp svneol=native#text/plain
 tests/webtbs/tw2002.pp svneol=native#text/plain
+tests/webtbs/tw20028.pp svneol=native#text/pascal
 tests/webtbs/tw20035a.pp svneol=native#text/pascal
 tests/webtbs/tw20035a.pp svneol=native#text/pascal
 tests/webtbs/tw20035b.pp svneol=native#text/pascal
 tests/webtbs/tw20035b.pp svneol=native#text/pascal
 tests/webtbs/tw20035c.pp svneol=native#text/pascal
 tests/webtbs/tw20035c.pp svneol=native#text/pascal
 tests/webtbs/tw2004.pp svneol=native#text/plain
 tests/webtbs/tw2004.pp svneol=native#text/plain
+tests/webtbs/tw20075.pp svneol=native#text/pascal
 tests/webtbs/tw20093.pp svneol=native#text/pascal
 tests/webtbs/tw20093.pp svneol=native#text/pascal
 tests/webtbs/tw20093a.pp svneol=native#text/pascal
 tests/webtbs/tw20093a.pp svneol=native#text/pascal
 tests/webtbs/tw20119.pp -text svneol=native#test/pascal
 tests/webtbs/tw20119.pp -text svneol=native#test/pascal
+tests/webtbs/tw20192.pp svneol=native#text/pascal
 tests/webtbs/tw20257.pp svneol=native#text/plain
 tests/webtbs/tw20257.pp svneol=native#text/plain
 tests/webtbs/tw2028.pp svneol=native#text/plain
 tests/webtbs/tw2028.pp svneol=native#text/plain
 tests/webtbs/tw2030.pp svneol=native#text/plain
 tests/webtbs/tw2030.pp svneol=native#text/plain
 tests/webtbs/tw2031.pp svneol=native#text/plain
 tests/webtbs/tw2031.pp svneol=native#text/plain
 tests/webtbs/tw2037.pp svneol=native#text/plain
 tests/webtbs/tw2037.pp svneol=native#text/plain
+tests/webtbs/tw20396.pp svneol=native#text/plain
 tests/webtbs/tw2040.pp svneol=native#text/plain
 tests/webtbs/tw2040.pp svneol=native#text/plain
 tests/webtbs/tw2041.pp svneol=native#text/plain
 tests/webtbs/tw2041.pp svneol=native#text/plain
+tests/webtbs/tw20421.pp svneol=native#text/pascal
 tests/webtbs/tw2045.pp svneol=native#text/plain
 tests/webtbs/tw2045.pp svneol=native#text/plain
 tests/webtbs/tw2046a.pp svneol=native#text/plain
 tests/webtbs/tw2046a.pp svneol=native#text/plain
+tests/webtbs/tw20527.pp svneol=native#text/plain
+tests/webtbs/tw20557.pp svneol=native#text/pascal
 tests/webtbs/tw2059.pp svneol=native#text/plain
 tests/webtbs/tw2059.pp svneol=native#text/plain
+tests/webtbs/tw20594.pp svneol=native#text/pascal
+tests/webtbs/tw20638.pp svneol=native#text/pascal
 tests/webtbs/tw2065.pp svneol=native#text/plain
 tests/webtbs/tw2065.pp svneol=native#text/plain
 tests/webtbs/tw2069.pp svneol=native#text/plain
 tests/webtbs/tw2069.pp svneol=native#text/plain
+tests/webtbs/tw20690.pp svneol=native#text/pascal
 tests/webtbs/tw2072.pp svneol=native#text/plain
 tests/webtbs/tw2072.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain
 tests/webtbs/tw2109.pp svneol=native#text/plain
 tests/webtbs/tw2110.pp svneol=native#text/plain
 tests/webtbs/tw2110.pp svneol=native#text/plain

+ 0 - 18
.gitignore

@@ -1703,24 +1703,6 @@ packages/fpmkunit/src/build-stamp.*
 packages/fpmkunit/src/fpcmade.*
 packages/fpmkunit/src/fpcmade.*
 packages/fpmkunit/src/units
 packages/fpmkunit/src/units
 packages/fpmkunit/units
 packages/fpmkunit/units
-packages/fpvectorial/*.bak
-packages/fpvectorial/*.exe
-packages/fpvectorial/*.o
-packages/fpvectorial/*.ppu
-packages/fpvectorial/*.s
-packages/fpvectorial/Package.fpc
-packages/fpvectorial/build-stamp.*
-packages/fpvectorial/fpcmade.*
-packages/fpvectorial/src/*.bak
-packages/fpvectorial/src/*.exe
-packages/fpvectorial/src/*.o
-packages/fpvectorial/src/*.ppu
-packages/fpvectorial/src/*.s
-packages/fpvectorial/src/Package.fpc
-packages/fpvectorial/src/build-stamp.*
-packages/fpvectorial/src/fpcmade.*
-packages/fpvectorial/src/units
-packages/fpvectorial/units
 packages/fuse/*.bak
 packages/fuse/*.bak
 packages/fuse/*.exe
 packages/fuse/*.exe
 packages/fuse/*.o
 packages/fuse/*.o

+ 9 - 2
compiler/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/09/08]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/11/02]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -2434,10 +2434,12 @@ override FPCOPT+=-P$(ARCH)
 endif
 endif
 ifeq ($(OS_SOURCE),openbsd)
 ifeq ($(OS_SOURCE),openbsd)
 override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
 override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
 endif
 endif
 ifndef CROSSBOOTSTRAP
 ifndef CROSSBOOTSTRAP
 ifneq ($(BINUTILSPREFIX),)
 ifneq ($(BINUTILSPREFIX),)
 override FPCOPT+=-XP$(BINUTILSPREFIX)
 override FPCOPT+=-XP$(BINUTILSPREFIX)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
 endif
 endif
 ifneq ($(BINUTILSPREFIX),)
 ifneq ($(BINUTILSPREFIX),)
 override FPCOPT+=-Xr$(RLINKPATH)
 override FPCOPT+=-Xr$(RLINKPATH)
@@ -2534,7 +2536,7 @@ override FPCOPT+=-Aas
 endif
 endif
 endif
 endif
 ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
 ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
-ifneq ($(findstring $(OS_TARGET),linux solaris),)
+ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifeq ($(CPU_TARGET),x86_64)
 ifeq ($(CPU_TARGET),x86_64)
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
 endif
 endif
@@ -3290,6 +3292,11 @@ ifdef CMP
 override DIFF:=$(CMP) -i218
 override DIFF:=$(CMP) -i218
 endif
 endif
 endif
 endif
+ifeq ($(findstring 2.4.,$(FPC_VERSION)),)
+ifndef ALLOW_WARNINGS
+override LOCALOPT+=-Sew
+endif
+endif
 override COMPILER+=$(LOCALOPT)
 override COMPILER+=$(LOCALOPT)
 PASDOC:=$(strip $(wildcard $(addsuffix /pasdoc.exe,$(SEARCHPATH))))
 PASDOC:=$(strip $(wildcard $(addsuffix /pasdoc.exe,$(SEARCHPATH))))
 ifeq ($(PASDOC),)
 ifeq ($(PASDOC),)

+ 8 - 0
compiler/Makefile.fpc

@@ -268,6 +268,14 @@ override DIFF:=$(CMP) -i218
 endif
 endif
 endif
 endif
 
 
+# Use -Sew option by default
+# Allow disabling by setting ALLOW_WARNINGS=1
+ifeq ($(findstring 2.4.,$(FPC_VERSION)),)
+ifndef ALLOW_WARNINGS
+override LOCALOPT+=-Sew
+endif
+endif
+
 # Add Local options
 # Add Local options
 override COMPILER+=$(LOCALOPT)
 override COMPILER+=$(LOCALOPT)
 
 

+ 19 - 4
compiler/aasmdata.pas

@@ -138,6 +138,8 @@ interface
       end;
       end;
       TAsmCFIClass=class of TAsmCFI;
       TAsmCFIClass=class of TAsmCFI;
 
 
+      { TAsmData }
+
       TAsmData = class
       TAsmData = class
       private
       private
         { Symbols }
         { Symbols }
@@ -147,6 +149,8 @@ interface
         FNextLabelNr   : array[TAsmLabeltype] of longint;
         FNextLabelNr   : array[TAsmLabeltype] of longint;
         { Call Frame Information for stack unwinding}
         { Call Frame Information for stack unwinding}
         FAsmCFI        : TAsmCFI;
         FAsmCFI        : TAsmCFI;
+        FConstPools    : array[TConstPoolType] of THashSet;
+        function GetConstPools(APoolType: TConstPoolType): THashSet;
       public
       public
         name,
         name,
         realname      : string[80];
         realname      : string[80];
@@ -156,8 +160,6 @@ interface
         CurrAsmList   : TAsmList;
         CurrAsmList   : TAsmList;
         WideInits     : TLinkedList;
         WideInits     : TLinkedList;
         ResStrInits   : TLinkedList;
         ResStrInits   : TLinkedList;
-        { hash tables for reusing constant storage }
-        ConstPools    : array[TConstPoolType] of THashSet;
         constructor create(const n:string);
         constructor create(const n:string);
         destructor  destroy;override;
         destructor  destroy;override;
         { asmsymbol }
         { asmsymbol }
@@ -176,6 +178,8 @@ interface
         procedure ResetAltSymbols;
         procedure ResetAltSymbols;
         property AsmSymbolDict:TFPHashObjectList read FAsmSymbolDict;
         property AsmSymbolDict:TFPHashObjectList read FAsmSymbolDict;
         property AsmCFI:TAsmCFI read FAsmCFI;
         property AsmCFI:TAsmCFI read FAsmCFI;
+        { hash tables for reusing constant storage }
+        property ConstPools[APoolType:TConstPoolType]: THashSet read GetConstPools;
       end;
       end;
 
 
       TTCInitItem = class(TLinkedListItem)
       TTCInitItem = class(TLinkedListItem)
@@ -315,6 +319,17 @@ implementation
                                 TAsmData
                                 TAsmData
 ****************************************************************************}
 ****************************************************************************}
 
 
+    function TAsmData.GetConstPools(APoolType: TConstPoolType): THashSet;
+      begin
+        if FConstPools[APoolType] = nil then
+          case APoolType of
+            sp_ansistr: FConstPools[APoolType] := TTagHashSet.Create(64, True, False);
+          else
+            FConstPools[APoolType] := THashSet.Create(64, True, False);
+          end;
+        Result := FConstPools[APoolType];
+      end;
+
     constructor TAsmData.create(const n:string);
     constructor TAsmData.create(const n:string);
       var
       var
         alt : TAsmLabelType;
         alt : TAsmLabelType;
@@ -376,7 +391,7 @@ implementation
          memasmlists.stop;
          memasmlists.stop;
 {$endif}
 {$endif}
          for hp := low(TConstPoolType) to high(TConstPoolType) do
          for hp := low(TConstPoolType) to high(TConstPoolType) do
-           ConstPools[hp].Free;
+           FConstPools[hp].Free;
       end;
       end;
 
 
 
 
@@ -454,7 +469,7 @@ implementation
 
 
     procedure TAsmData.getlabel(out l : TAsmLabel;alt:TAsmLabeltype);
     procedure TAsmData.getlabel(out l : TAsmLabel;alt:TAsmLabeltype);
       begin
       begin
-        if (target_info.system in systems_linux) and
+        if (target_info.system in (systems_linux + systems_bsd)) and
            (cs_create_smart in current_settings.moduleswitches) and
            (cs_create_smart in current_settings.moduleswitches) and
            (alt = alt_dbgline) then
            (alt = alt_dbgline) then
           l:=TAsmLabel.createglobal(AsmSymbolDict,name,FNextLabelNr[alt],alt)
           l:=TAsmLabel.createglobal(AsmSymbolDict,name,FNextLabelNr[alt],alt)

+ 21 - 10
compiler/aasmtai.pas

@@ -298,12 +298,12 @@ interface
         'extern','nasm_import', 'tc', 'reference',
         'extern','nasm_import', 'tc', 'reference',
         'no_dead_strip','weak_reference','lazy_reference','weak_definition'
         'no_dead_strip','weak_reference','lazy_reference','weak_definition'
       );
       );
-      sehdirectivestr : array[TAsmSehDirective] of string[15]=(
-        'seh_proc','seh_endproc',
-        'seh_endprologue','seh_handler','seh_handlerdata',
-        'seh_eh','seh_32','seh_no32',
-        'seh_setframe','seh_stackalloc','seh_pushreg',
-        'seh_savereg','seh_savexmm','seh_pushframe'
+      sehdirectivestr : array[TAsmSehDirective] of string[16]=(
+        '.seh_proc','.seh_endproc',
+        '.seh_endprologue','.seh_handler','.seh_handlerdata',
+        '.seh_eh','.seh_32','seh_no32',
+        '.seh_setframe','.seh_stackalloc','.seh_pushreg',
+        '.seh_savereg','.seh_savexmm','.seh_pushframe'
       );
       );
 
 
     type
     type
@@ -416,10 +416,12 @@ interface
           destructor Destroy;override;
           destructor Destroy;override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
+{$push}{$warnings off}
          private
          private
           { this constructor is made private on purpose }
           { this constructor is made private on purpose }
           { because sections should be created via new_section() }
           { because sections should be created via new_section() }
           constructor Create(Asectype:TAsmSectiontype;const Aname:string;Aalign:byte;Asecorder:TasmSectionorder=secorder_default);
           constructor Create(Asectype:TAsmSectiontype;const Aname:string;Aalign:byte;Asecorder:TasmSectionorder=secorder_default);
+{$pop}
        end;
        end;
 
 
 
 
@@ -686,7 +688,7 @@ interface
         TSehDirectiveData=record
         TSehDirectiveData=record
         case typ: TSehDirectiveDatatype of
         case typ: TSehDirectiveDatatype of
           sd_none: ();
           sd_none: ();
-          sd_string: (name:pshortstring);
+          sd_string: (name:pshortstring;flags:byte);
           sd_reg,sd_offset,sd_regoffset: (reg:TRegister;offset:dword);
           sd_reg,sd_offset,sd_regoffset: (reg:TRegister;offset:dword);
         end;
         end;
 
 
@@ -2542,7 +2544,7 @@ implementation
         sd_string,     { proc }
         sd_string,     { proc }
         sd_none,       { endproc }
         sd_none,       { endproc }
         sd_none,       { endprologue }
         sd_none,       { endprologue }
-        sd_none,       { TODO: handler }
+        sd_string,     { handler }
         sd_none,       { handlerdata }
         sd_none,       { handlerdata }
         sd_none,sd_none,sd_none,  { eh, 32, no32 }
         sd_none,sd_none,sd_none,  { eh, 32, no32 }
         sd_regoffset,  { setframe }
         sd_regoffset,  { setframe }
@@ -2595,7 +2597,10 @@ implementation
         case data.typ of
         case data.typ of
           sd_none: ;
           sd_none: ;
           sd_string:
           sd_string:
-            data.name:=stringdup(ppufile.getstring);
+            begin
+              data.name:=stringdup(ppufile.getstring);
+              data.flags:=ppufile.getbyte;
+            end;
 
 
           sd_reg,sd_offset,sd_regoffset:
           sd_reg,sd_offset,sd_regoffset:
             begin
             begin
@@ -2621,7 +2626,11 @@ implementation
         case data.typ of
         case data.typ of
           sd_none: ;
           sd_none: ;
           sd_string:
           sd_string:
-            ppufile.putstring(data.name^);
+            begin
+              ppufile.putstring(data.name^);
+              ppufile.putbyte(data.flags);
+            end;
+
           sd_reg,sd_offset,sd_regoffset:
           sd_reg,sd_offset,sd_regoffset:
             begin
             begin
               ppufile.putdata(data.reg,sizeof(TRegister));
               ppufile.putdata(data.reg,sizeof(TRegister));
@@ -2637,7 +2646,9 @@ implementation
       end;
       end;
 
 
 begin
 begin
+{$push}{$warnings off}
   { taitype should fit into a 4 byte set for speed reasons }
   { taitype should fit into a 4 byte set for speed reasons }
   if ord(high(taitype))>31 then
   if ord(high(taitype))>31 then
     internalerror(201108181);
     internalerror(201108181);
+{$pop}
 end.
 end.

+ 11 - 3
compiler/aggas.pas

@@ -390,7 +390,7 @@ implementation
           end;
           end;
 
 
         if (atype=sec_threadvar) and
         if (atype=sec_threadvar) and
-          (target_info.system=system_i386_win32) then
+          (target_info.system in (systems_windows+systems_wince)) then
           secname:='.tls';
           secname:='.tls';
 
 
         { go32v2 stub only loads .text and .data sections, and allocates space for .bss.
         { go32v2 stub only loads .text and .data sections, and allocates space for .bss.
@@ -1238,11 +1238,18 @@ implementation
 
 
            ait_seh_directive :
            ait_seh_directive :
              begin
              begin
-               AsmWrite('.'+sehdirectivestr[tai_seh_directive(hp).kind]);
+{$ifdef TEST_WIN64_UNWIND}
+               AsmWrite(sehdirectivestr[tai_seh_directive(hp).kind]);
                case tai_seh_directive(hp).datatype of
                case tai_seh_directive(hp).datatype of
                  sd_none:;
                  sd_none:;
                  sd_string:
                  sd_string:
-                   AsmWrite(' '+tai_seh_directive(hp).data.name^);
+                   begin
+                     AsmWrite(' '+tai_seh_directive(hp).data.name^);
+                     if (tai_seh_directive(hp).data.flags and 1)<>0 then
+                       AsmWrite(',@except');
+                     if (tai_seh_directive(hp).data.flags and 2)<>0 then
+                       AsmWrite(',@unwind');
+                   end;
                  sd_reg:
                  sd_reg:
                    AsmWrite(' '+gas_regname(tai_seh_directive(hp).data.reg));
                    AsmWrite(' '+gas_regname(tai_seh_directive(hp).data.reg));
                  sd_offset:
                  sd_offset:
@@ -1252,6 +1259,7 @@ implementation
                      tostr(tai_seh_directive(hp).data.offset));
                      tostr(tai_seh_directive(hp).data.offset));
                end;
                end;
                AsmLn;
                AsmLn;
+{$endif TEST_WIN64_UNWIND}
              end;
              end;
 
 
            else
            else

+ 2 - 7
compiler/aoptobj.pas

@@ -884,10 +884,8 @@ Unit AoptObj;
       end;
       end;
 
 
 
 
-{$ifopt r+}
-{$define rangewason}
+{$push}
 {$r-}
 {$r-}
-{$endif}
     function tAOptObj.getlabelwithsym(sym: tasmlabel): tai;
     function tAOptObj.getlabelwithsym(sym: tasmlabel): tai;
       begin
       begin
         if (int64(sym.labelnr) >= int64(labelinfo^.lowlabel)) and
         if (int64(sym.labelnr) >= int64(labelinfo^.lowlabel)) and
@@ -896,10 +894,7 @@ Unit AoptObj;
         else
         else
           getlabelwithsym := nil;
           getlabelwithsym := nil;
       end;
       end;
-{$ifdef rangewason}
-{$r+}
-{$undef rangewason}
-{$endif}
+{$pop}
 
 
     function TAOptObj.GetFinalDestination(hp: taicpu; level: longint): boolean;
     function TAOptObj.GetFinalDestination(hp: taicpu; level: longint): boolean;
       {traces sucessive jumps to their final destination and sets it, e.g.
       {traces sucessive jumps to their final destination and sets it, e.g.

+ 15 - 7
compiler/arm/cgcpu.pas

@@ -112,6 +112,8 @@ unit cgcpu;
         procedure a_loadmm_reg_intreg(list: TAsmList; fromsize, tosize : tcgsize;mmreg, intreg: tregister; shuffle : pmmshuffle); override;
         procedure a_loadmm_reg_intreg(list: TAsmList; fromsize, tosize : tcgsize;mmreg, intreg: tregister; shuffle : pmmshuffle); override;
 
 
         procedure a_opmm_reg_reg(list: TAsmList; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle); override;
         procedure a_opmm_reg_reg(list: TAsmList; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle); override;
+        { Transform unsupported methods into Internal errors }
+        procedure a_bit_scan_reg_reg(list: TAsmList; reverse: boolean; size: TCGSize; src, dst: TRegister); override;
       private
       private
         { clear out potential overflow bits from 8 or 16 bit operations  }
         { clear out potential overflow bits from 8 or 16 bit operations  }
         { the upper 24/16 bits of a register after an operation          }
         { the upper 24/16 bits of a register after an operation          }
@@ -283,6 +285,7 @@ unit cgcpu;
                current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(longint(a)));
                current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(longint(a)));
 
 
                hr.symbol:=l;
                hr.symbol:=l;
+               hr.base:=NR_PC;
                list.concat(taicpu.op_reg_ref(A_LDR,reg,hr));
                list.concat(taicpu.op_reg_ref(A_LDR,reg,hr));
             end;
             end;
        end;
        end;
@@ -514,7 +517,8 @@ unit cgcpu;
         branchopcode: tasmop;
         branchopcode: tasmop;
       begin
       begin
         { check not really correct: should only be used for non-Thumb cpus }
         { check not really correct: should only be used for non-Thumb cpus }
-        if (current_settings.cputype<cpu_armv5) then
+        if (current_settings.cputype<cpu_armv5) or
+           (current_settings.cputype in cpu_thumb2) then
           branchopcode:=A_BL
           branchopcode:=A_BL
         else
         else
           branchopcode:=A_BLX;
           branchopcode:=A_BLX;
@@ -640,8 +644,7 @@ unit cgcpu;
 
 
         if is_shifter_const(a,shift) and not(op in [OP_IMUL,OP_MUL]) then
         if is_shifter_const(a,shift) and not(op in [OP_IMUL,OP_MUL]) then
           case op of
           case op of
-            OP_NEG,OP_NOT,
-            OP_DIV,OP_IDIV:
+            OP_NEG,OP_NOT:
               internalerror(200308281);
               internalerror(200308281);
             OP_SHL:
             OP_SHL:
               begin
               begin
@@ -742,11 +745,11 @@ unit cgcpu;
         else
         else
           begin
           begin
             { there could be added some more sophisticated optimizations }
             { there could be added some more sophisticated optimizations }
-            if (op in [OP_MUL,OP_IMUL]) and (a=1) then
+            if (op in [OP_MUL,OP_IMUL,OP_DIV,OP_IDIV]) and (a=1) then
               a_load_reg_reg(list,size,size,src,dst)
               a_load_reg_reg(list,size,size,src,dst)
             else if (op in [OP_MUL,OP_IMUL]) and (a=0) then
             else if (op in [OP_MUL,OP_IMUL]) and (a=0) then
               a_load_const_reg(list,size,0,dst)
               a_load_const_reg(list,size,0,dst)
-            else if (op in [OP_IMUL]) and (a=-1) then
+            else if (op in [OP_IMUL,OP_IDIV]) and (a=-1) then
               a_op_reg_reg(list,OP_NEG,size,src,dst)
               a_op_reg_reg(list,OP_NEG,size,src,dst)
             { we do this here instead in the peephole optimizer because
             { we do this here instead in the peephole optimizer because
               it saves us a register }
               it saves us a register }
@@ -935,6 +938,7 @@ unit cgcpu;
            ((op in [A_LDF,A_STF,A_FLDS,A_FLDD,A_FSTS,A_FSTD]) and
            ((op in [A_LDF,A_STF,A_FLDS,A_FLDD,A_FSTS,A_FSTD]) and
             ((ref.offset<-1020) or
             ((ref.offset<-1020) or
              (ref.offset>1020) or
              (ref.offset>1020) or
+             ((abs(ref.offset) mod 4)<>0) or
              { the usual pc relative symbol handling assumes possible offsets of +/- 4095 }
              { the usual pc relative symbol handling assumes possible offsets of +/- 4095 }
              assigned(ref.symbol)
              assigned(ref.symbol)
             )
             )
@@ -1350,6 +1354,11 @@ unit cgcpu;
       end;
       end;
 
 
 
 
+    procedure tcgarm.a_bit_scan_reg_reg(list: TAsmList; reverse: boolean; size: TCGSize; src, dst: TRegister);
+      begin
+        Comment(V_Error,'tcgarm.a_bit_scan_reg_reg method not implemented');
+      end;
+
     procedure tcgarm.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel);
     procedure tcgarm.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel);
       begin
       begin
         list.concat(taicpu.op_reg_reg(A_CMP,reg2,reg1));
         list.concat(taicpu.op_reg_reg(A_CMP,reg2,reg1));
@@ -3192,8 +3201,7 @@ unit cgcpu;
       begin
       begin
         ovloc.loc:=LOC_VOID;
         ovloc.loc:=LOC_VOID;
         case op of
         case op of
-           OP_NEG,OP_NOT,
-           OP_DIV,OP_IDIV:
+           OP_NEG,OP_NOT:
               internalerror(200308281);
               internalerror(200308281);
            OP_ROL:
            OP_ROL:
               begin
               begin

+ 4 - 0
compiler/arm/cpuinfo.pas

@@ -202,6 +202,10 @@ Const
    );
    );
 
 
 
 
+    { We know that there are fields after sramsize
+      but we don't care about this warning }
+    {$WARN 3177 OFF}
+
    embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
    embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
    ((
    ((
    	controllertypestr:'';
    	controllertypestr:'';

+ 83 - 25
compiler/arm/narmmat.pas

@@ -54,7 +54,8 @@ implementation
       pass_2,procinfo,
       pass_2,procinfo,
       ncon,
       ncon,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
-      ncgutil,cgcpu;
+      ncgutil,cgcpu,
+      nadd,pass_1,symdef;
 
 
 {*****************************************************************************
 {*****************************************************************************
                              TARMMODDIVNODE
                              TARMMODDIVNODE
@@ -72,6 +73,26 @@ implementation
           ) and
           ) and
           not(is_64bitint(resultdef)) then
           not(is_64bitint(resultdef)) then
           result:=nil
           result:=nil
+        else if (current_settings.cputype in [cpu_armv7m]) and
+          (nodetype=divn) and
+          not(is_64bitint(resultdef)) then
+          result:=nil
+        else if (current_settings.cputype in [cpu_armv7m]) and
+          (nodetype=modn) and
+          not(is_64bitint(resultdef)) then
+          begin
+            if (right.nodetype=ordconstn) and
+              ispowerof2(tordconstnode(right).value,power) and
+              (tordconstnode(right).value<=256) and
+              (tordconstnode(right).value>0) then
+              result:=caddnode.create(andn,left,cordconstnode.create(tordconstnode(right).value-1,sinttype,false))
+            else
+              begin
+                result:=caddnode.create(subn,left,caddnode.create(muln,right.getcopy, cmoddivnode.Create(divn,left.getcopy,right.getcopy)));
+                right:=nil;
+              end;
+            left:=nil;
+          end
         else
         else
           result:=inherited first_moddivint;
           result:=inherited first_moddivint;
       end;
       end;
@@ -167,38 +188,75 @@ implementation
       begin
       begin
         secondpass(left);
         secondpass(left);
         secondpass(right);
         secondpass(right);
-        location_copy(location,left.location);
-
-        { put numerator in register }
-        size:=def_cgsize(left.resultdef);
-        location_force_reg(current_asmdata.CurrAsmList,left.location,
-          size,true);
-        location_copy(location,left.location);
-        numerator:=location.register;
-        resultreg:=location.register;
-        if location.loc=LOC_CREGISTER then
+
+        if (current_settings.cputype in [cpu_armv7m]) and
+           (nodetype=divn) and
+           not(is_64bitint(resultdef)) then
           begin
           begin
+            size:=def_cgsize(left.resultdef);
+            location_force_reg(current_asmdata.CurrAsmList,left.location,size,true);
+
+            location_copy(location,left.location);
             location.loc := LOC_REGISTER;
             location.loc := LOC_REGISTER;
             location.register := cg.getintregister(current_asmdata.CurrAsmList,size);
             location.register := cg.getintregister(current_asmdata.CurrAsmList,size);
             resultreg:=location.register;
             resultreg:=location.register;
-          end
-        else if (nodetype=modn) or (right.nodetype=ordconstn) then
-          begin
-            // for a modulus op, and for const nodes we need the result register
-            // to be an extra register
-            resultreg:=cg.getintregister(current_asmdata.CurrAsmList,size);
-          end;
 
 
-        if right.nodetype=ordconstn then
-          begin
-            if nodetype=divn then
-              genOrdConstNodeDiv
+            if (right.nodetype=ordconstn) and
+               ((tordconstnode(right).value=1) or
+                (tordconstnode(right).value=int64(-1)) or
+                (tordconstnode(right).value=0) or
+                ispowerof2(tordconstnode(right).value,power)) then
+              begin
+                numerator:=left.location.register;
+
+                genOrdConstNodeDiv;
+              end
             else
             else
-//              genOrdConstNodeMod;
+              begin
+                location_force_reg(current_asmdata.CurrAsmList,right.location,size,true);
+
+                if is_signed(left.resultdef) or
+                   is_signed(right.resultdef) then
+                  cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_IDIV,OS_INT,right.location.register,left.location.register,location.register)
+                else
+                  cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_DIV,OS_INT,right.location.register,left.location.register,location.register);
+              end;
+          end
+        else
+          begin
+            location_copy(location,left.location);
+
+            { put numerator in register }
+            size:=def_cgsize(left.resultdef);
+            location_force_reg(current_asmdata.CurrAsmList,left.location,
+              size,true);
+            location_copy(location,left.location);
+            numerator:=location.register;
+            resultreg:=location.register;
+            if location.loc=LOC_CREGISTER then
+              begin
+                location.loc := LOC_REGISTER;
+                location.register := cg.getintregister(current_asmdata.CurrAsmList,size);
+                resultreg:=location.register;
+              end
+            else if (nodetype=modn) or (right.nodetype=ordconstn) then
+              begin
+                // for a modulus op, and for const nodes we need the result register
+                // to be an extra register
+                resultreg:=cg.getintregister(current_asmdata.CurrAsmList,size);
+              end;
+
+            if right.nodetype=ordconstn then
+              begin
+                if nodetype=divn then
+                  genOrdConstNodeDiv
+                else
+    //              genOrdConstNodeMod;
+              end;
+
+            location.register:=resultreg;
           end;
           end;
 
 
-        location.register:=resultreg;
-
         { unsigned division/module can only overflow in case of division by zero }
         { unsigned division/module can only overflow in case of division by zero }
         { (but checking this overflow flag is more convoluted than performing a  }
         { (but checking this overflow flag is more convoluted than performing a  }
         {  simple comparison with 0)                                             }
         {  simple comparison with 0)                                             }

+ 96 - 91
compiler/arm/raarmgas.pas

@@ -163,22 +163,22 @@ Unit raarmgas;
       procedure test_end(require_rbracket : boolean);
       procedure test_end(require_rbracket : boolean);
         begin
         begin
           if require_rbracket then begin
           if require_rbracket then begin
-            if not(actasmtoken=AS_RBRACKET) then 
-              begin 
-                do_error; 
-                exit; 
+            if not(actasmtoken=AS_RBRACKET) then
+              begin
+                do_error;
+                exit;
               end
               end
-            else 
+            else
               Consume(AS_RBRACKET);
               Consume(AS_RBRACKET);
-            if (actasmtoken=AS_NOT) then 
+            if (actasmtoken=AS_NOT) then
               begin
               begin
                 oper.opr.ref.addressmode:=AM_PREINDEXED;
                 oper.opr.ref.addressmode:=AM_PREINDEXED;
                 Consume(AS_NOT);
                 Consume(AS_NOT);
               end;
               end;
           end;
           end;
-          if not(actasmtoken in [AS_SEPARATOR,AS_end]) then 
+          if not(actasmtoken in [AS_SEPARATOR,AS_end]) then
             do_error
             do_error
-          else 
+          else
             begin
             begin
 {$IFDEF debugasmreader}
 {$IFDEF debugasmreader}
               writeln('TEST_end_FINAL_OK. Created the following ref:');
               writeln('TEST_end_FINAL_OK. Created the following ref:');
@@ -197,64 +197,67 @@ Unit raarmgas;
       function is_shifter_ref_operation(var a : tshiftmode) : boolean;
       function is_shifter_ref_operation(var a : tshiftmode) : boolean;
         begin
         begin
           a := SM_NONE;
           a := SM_NONE;
-          if      (actasmpattern='LSL') then 
+          if      (actasmpattern='LSL') then
             a := SM_LSL
             a := SM_LSL
-          else if (actasmpattern='LSR') then 
+          else if (actasmpattern='LSR') then
             a := SM_LSR
             a := SM_LSR
-          else if (actasmpattern='ASR') then 
+          else if (actasmpattern='ASR') then
             a := SM_ASR
             a := SM_ASR
-          else if (actasmpattern='ROR') then 
+          else if (actasmpattern='ROR') then
             a := SM_ROR
             a := SM_ROR
-          else if (actasmpattern='RRX') then 
+          else if (actasmpattern='RRX') then
             a := SM_RRX;
             a := SM_RRX;
           is_shifter_ref_operation := not(a=SM_NONE);
           is_shifter_ref_operation := not(a=SM_NONE);
         end;
         end;
 
 
 
 
       procedure read_index_shift(require_rbracket : boolean);
       procedure read_index_shift(require_rbracket : boolean);
+        var
+          shift : aint;
         begin
         begin
           case actasmtoken of
           case actasmtoken of
-            AS_COMMA : 
+            AS_COMMA :
               begin
               begin
                 Consume(AS_COMMA);
                 Consume(AS_COMMA);
-                if not(actasmtoken=AS_ID) then 
+                if not(actasmtoken=AS_ID) then
                   do_error;
                   do_error;
-                if is_shifter_ref_operation(oper.opr.ref.shiftmode) then 
+                if is_shifter_ref_operation(oper.opr.ref.shiftmode) then
                   begin
                   begin
                     Consume(AS_ID);
                     Consume(AS_ID);
-                    if not(oper.opr.ref.shiftmode=SM_RRX) then 
+                    if not(oper.opr.ref.shiftmode=SM_RRX) then
                       begin
                       begin
-                        if not(actasmtoken=AS_HASH) then 
+                        if not(actasmtoken=AS_HASH) then
                           do_error;
                           do_error;
                         Consume(AS_HASH);
                         Consume(AS_HASH);
-                        oper.opr.ref.shiftimm := BuildConstExpression(false,true);
-                        if (oper.opr.ref.shiftimm<0) or (oper.opr.ref.shiftimm>32) then 
+                        shift := BuildConstExpression(false,true);
+                        if (shift<0) or (shift>32) then
                           do_error;
                           do_error;
+                        oper.opr.ref.shiftimm := shift;
                         test_end(require_rbracket);
                         test_end(require_rbracket);
                       end;
                       end;
-                   end 
-                 else 
-                   begin 
-                     do_error; 
-                     exit; 
+                   end
+                 else
+                   begin
+                     do_error;
+                     exit;
                    end;
                    end;
               end;
               end;
-            AS_RBRACKET : 
-              if require_rbracket then 
+            AS_RBRACKET :
+              if require_rbracket then
                 test_end(require_rbracket)
                 test_end(require_rbracket)
-              else 
-                begin 
-                  do_error; 
-                  exit; 
+              else
+                begin
+                  do_error;
+                  exit;
                 end;
                 end;
-            AS_SEPARATOR,AS_END : 
-              if not require_rbracket then 
+            AS_SEPARATOR,AS_END :
+              if not require_rbracket then
                 test_end(false)
                 test_end(false)
-               else 
-                 do_error; 
-            else 
+               else
+                 do_error;
+            else
               begin
               begin
-                do_error; 
+                do_error;
                 exit;
                 exit;
               end;
               end;
           end;
           end;
@@ -262,39 +265,39 @@ Unit raarmgas;
 
 
 
 
       procedure read_index(require_rbracket : boolean);
       procedure read_index(require_rbracket : boolean);
-        var 
+        var
           recname : string;
           recname : string;
           o_int,s_int : aint;
           o_int,s_int : aint;
         begin
         begin
           case actasmtoken of
           case actasmtoken of
-            AS_REGISTER : 
+            AS_REGISTER :
               begin
               begin
-                oper.opr.ref.index:=actasmregister;  
+                oper.opr.ref.index:=actasmregister;
                 Consume(AS_REGISTER);
                 Consume(AS_REGISTER);
                 read_index_shift(require_rbracket);
                 read_index_shift(require_rbracket);
                 exit;
                 exit;
               end;
               end;
-            AS_PLUS,AS_MINUS : 
+            AS_PLUS,AS_MINUS :
               begin
               begin
-                if actasmtoken=AS_PLUS then 
+                if actasmtoken=AS_PLUS then
                   begin
                   begin
                     Consume(AS_PLUS);
                     Consume(AS_PLUS);
-                  end 
-                else 
+                  end
+                else
                   begin
                   begin
                     oper.opr.ref.signindex := -1;
                     oper.opr.ref.signindex := -1;
                     Consume(AS_MINUS);
                     Consume(AS_MINUS);
                   end;
                   end;
-                if actasmtoken=AS_REGISTER then 
+                if actasmtoken=AS_REGISTER then
                   begin
                   begin
-                    oper.opr.ref.index:=actasmregister;   
+                    oper.opr.ref.index:=actasmregister;
                     Consume(AS_REGISTER);
                     Consume(AS_REGISTER);
                     read_index_shift(require_rbracket);
                     read_index_shift(require_rbracket);
                     exit;
                     exit;
-                  end 
-                else 
+                  end
+                else
                   begin
                   begin
-                    do_error; 
+                    do_error;
                     exit;
                     exit;
                   end;
                   end;
                 test_end(require_rbracket);
                 test_end(require_rbracket);
@@ -304,13 +307,13 @@ Unit raarmgas;
               begin
               begin
                 Consume(AS_HASH);
                 Consume(AS_HASH);
                 o_int := BuildConstExpression(false,true);
                 o_int := BuildConstExpression(false,true);
-                if (o_int>4095) or (o_int<-4095) then 
+                if (o_int>4095) or (o_int<-4095) then
                   begin
                   begin
                     Message(asmr_e_constant_out_of_bounds);
                     Message(asmr_e_constant_out_of_bounds);
                     RecoverConsume(false);
                     RecoverConsume(false);
                     exit;
                     exit;
-                  end 
-                else 
+                  end
+                else
                   begin
                   begin
                     inc(oper.opr.ref.offset,o_int);
                     inc(oper.opr.ref.offset,o_int);
                     test_end(require_rbracket);
                     test_end(require_rbracket);
@@ -322,20 +325,20 @@ Unit raarmgas;
                 recname := actasmpattern;
                 recname := actasmpattern;
                 Consume(AS_ID);
                 Consume(AS_ID);
                 BuildRecordOffsetSize(recname,o_int,s_int,recname,false);
                 BuildRecordOffsetSize(recname,o_int,s_int,recname,false);
-                if (o_int>4095)or(o_int<-4095) then 
+                if (o_int>4095)or(o_int<-4095) then
                   begin
                   begin
                     Message(asmr_e_constant_out_of_bounds);
                     Message(asmr_e_constant_out_of_bounds);
                     RecoverConsume(false);
                     RecoverConsume(false);
                     exit;
                     exit;
-                  end 
-                else 
+                  end
+                else
                   begin
                   begin
                     inc(oper.opr.ref.offset,o_int);
                     inc(oper.opr.ref.offset,o_int);
                     test_end(require_rbracket);
                     test_end(require_rbracket);
                     exit;
                     exit;
                   end;
                   end;
               end;
               end;
-            AS_AT: 
+            AS_AT:
               begin
               begin
                 do_error;
                 do_error;
                 exit;
                 exit;
@@ -348,34 +351,34 @@ Unit raarmgas;
               end;
               end;
             AS_RBRACKET :
             AS_RBRACKET :
               begin
               begin
-                if require_rbracket then 
+                if require_rbracket then
                   begin
                   begin
                     test_end(require_rbracket);
                     test_end(require_rbracket);
                     exit;
                     exit;
-                  end 
-                else 
+                  end
+                else
                   begin
                   begin
                     do_error; // unexpected rbracket
                     do_error; // unexpected rbracket
                     exit;
                     exit;
                   end;
                   end;
               end;
               end;
-            AS_SEPARATOR,AS_end : 
+            AS_SEPARATOR,AS_end :
               begin
               begin
-                if not require_rbracket then 
+                if not require_rbracket then
                   begin
                   begin
                     test_end(false);
                     test_end(false);
                     exit;
                     exit;
-                  end 
-                else 
+                  end
+                else
                   begin
                   begin
-                    do_error; 
+                    do_error;
                     exit;
                     exit;
                   end;
                   end;
               end;
               end;
-            else 
+            else
               begin
               begin
                 // unexpected token
                 // unexpected token
-                do_error; 
+                do_error;
                 exit;
                 exit;
               end;
               end;
           end; // case
           end; // case
@@ -386,31 +389,31 @@ Unit raarmgas;
         begin
         begin
           Consume(AS_RBRACKET);
           Consume(AS_RBRACKET);
           case actasmtoken of
           case actasmtoken of
-            AS_COMMA : 
+            AS_COMMA :
               begin // post-indexed
               begin // post-indexed
                 Consume(AS_COMMA);
                 Consume(AS_COMMA);
                 oper.opr.ref.addressmode:=AM_POSTINDEXED;
                 oper.opr.ref.addressmode:=AM_POSTINDEXED;
                 read_index(false);
                 read_index(false);
                 exit;
                 exit;
               end;
               end;
-            AS_NOT : 
+            AS_NOT :
               begin   // pre-indexed
               begin   // pre-indexed
                 Consume(AS_NOT);
                 Consume(AS_NOT);
                 oper.opr.ref.addressmode:=AM_PREINDEXED;
                 oper.opr.ref.addressmode:=AM_PREINDEXED;
                 test_end(false);
                 test_end(false);
                 exit;
                 exit;
               end;
               end;
-            else 
+            else
               begin
               begin
                 test_end(false);
                 test_end(false);
                 exit;
                 exit;
               end;
               end;
           end; // case
           end; // case
         end;
         end;
- 
-      var 
+
+      var
         lab : TASMLABEL;
         lab : TASMLABEL;
-      begin 
+      begin
         Consume(AS_LBRACKET);
         Consume(AS_LBRACKET);
         oper.opr.ref.addressmode:=AM_OFFSET; // assume "neither PRE nor POST inc"
         oper.opr.ref.addressmode:=AM_OFFSET; // assume "neither PRE nor POST inc"
         if actasmtoken=AS_REGISTER then
         if actasmtoken=AS_REGISTER then
@@ -418,25 +421,25 @@ Unit raarmgas;
             oper.opr.ref.base:=actasmregister;
             oper.opr.ref.base:=actasmregister;
             Consume(AS_REGISTER);
             Consume(AS_REGISTER);
             case actasmtoken of
             case actasmtoken of
-              AS_RBRACKET : 
-                begin 
-                  try_prepostindexed; 
-                  exit; 
+              AS_RBRACKET :
+                begin
+                  try_prepostindexed;
+                  exit;
                 end;
                 end;
-              AS_COMMA : 
-                begin 
-                  Consume(AS_COMMA); 
-                  read_index(true); 
-                  exit; 
+              AS_COMMA :
+                begin
+                  Consume(AS_COMMA);
+                  read_index(true);
+                  exit;
                 end;
                 end;
-              else 
+              else
                 begin
                 begin
                   Message(asmr_e_invalid_reference_syntax);
                   Message(asmr_e_invalid_reference_syntax);
                   RecoverConsume(false);
                   RecoverConsume(false);
                 end;
                 end;
             end;
             end;
           end
           end
-        else 
+        else
 {
 {
   if base isn't a register, r15=PC is implied base, so it must be a local label.
   if base isn't a register, r15=PC is implied base, so it must be a local label.
   pascal constants don't make sense, because implied r15
   pascal constants don't make sense, because implied r15
@@ -448,25 +451,26 @@ Unit raarmgas;
 
 
           Begin
           Begin
             case actasmtoken of
             case actasmtoken of
-              AS_ID : 
+              AS_ID :
                 begin
                 begin
-                  if is_locallabel(actasmpattern) then 
+                  if is_locallabel(actasmpattern) then
                     begin
                     begin
                       CreateLocalLabel(actasmpattern,lab,false);
                       CreateLocalLabel(actasmpattern,lab,false);
                       oper.opr.ref.symbol := lab;
                       oper.opr.ref.symbol := lab;
+                      oper.opr.ref.base := NR_PC;
                       Consume(AS_ID);
                       Consume(AS_ID);
                       test_end(true);
                       test_end(true);
                       exit;
                       exit;
-                    end 
-                  else 
+                    end
+                  else
                     begin
                     begin
-                      // TODO: Stackpointer implied, 
+                      // TODO: Stackpointer implied,
                       Message(asmr_e_invalid_reference_syntax);
                       Message(asmr_e_invalid_reference_syntax);
                       RecoverConsume(false);
                       RecoverConsume(false);
                       exit;
                       exit;
                     end;
                     end;
                 end;
                 end;
-              else 
+              else
                 begin // elsecase
                 begin // elsecase
                   Message(asmr_e_invalid_reference_syntax);
                   Message(asmr_e_invalid_reference_syntax);
                   RecoverConsume(false);
                   RecoverConsume(false);
@@ -544,6 +548,7 @@ Unit raarmgas;
              begin
              begin
                oper.InitRef;
                oper.InitRef;
                oper.opr.ref.symbol:=hl;
                oper.opr.ref.symbol:=hl;
+               oper.opr.ref.base:=NR_PC;
              end;
              end;
           end;
           end;
 
 
@@ -650,7 +655,7 @@ Unit raarmgas;
           var icond: tasmcond;
           var icond: tasmcond;
           begin
           begin
             is_ConditionCode := false;
             is_ConditionCode := false;
-            
+
             if actopcode in [A_IT,A_ITE,A_ITT,
             if actopcode in [A_IT,A_ITE,A_ITT,
                              A_ITEE,A_ITTE,A_ITET,A_ITTT,
                              A_ITEE,A_ITTE,A_ITET,A_ITTT,
                              A_ITEEE,A_ITTEE,A_ITETE,A_ITTTE,A_ITEET,A_ITTET,A_ITETT,A_ITTTT] then
                              A_ITEEE,A_ITTEE,A_ITETE,A_ITTTE,A_ITEET,A_ITTET,A_ITETT,A_ITTTT] then
@@ -1066,7 +1071,7 @@ Unit raarmgas;
           end;
           end;
         if actopcode=A_NONE then
         if actopcode=A_NONE then
           exit;
           exit;
-			 
+
         { search for condition, conditions are always 2 chars }
         { search for condition, conditions are always 2 chars }
         if length(hs)>1 then
         if length(hs)>1 then
           begin
           begin

+ 20 - 7
compiler/asmutils.pas

@@ -26,26 +26,26 @@ interface
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
 
 
 uses
 uses
+  globtype,
   aasmbase,
   aasmbase,
   aasmdata;
   aasmdata;
 
 
 
 
-    function emit_ansistring_const(list:TAsmList;data:PChar;len:LongInt;NewSection:Boolean=True):TAsmLabel;
-    function emit_unicodestring_const(list:TAsmList;data:Pointer;Winlike:Boolean):TAsmLabel;
+    function emit_ansistring_const(list:TAsmList;data:PChar;len:LongInt;encoding:tstringencoding;NewSection:Boolean=True):TAsmLabel;
+    function emit_unicodestring_const(list:TAsmList;data:Pointer;encoding:tstringencoding;Winlike:Boolean):TAsmLabel;
 
 
 
 
 implementation
 implementation
 
 
 uses
 uses
   globals,
   globals,
-  globtype,
   systems,
   systems,
   verbose,
   verbose,
   aasmtai,
   aasmtai,
   widestr,
   widestr,
   symdef;
   symdef;
 
 
-    function emit_ansistring_const(list:TAsmList;data:PChar;len:LongInt;NewSection:Boolean): TAsmLabel;
+    function emit_ansistring_const(list:TAsmList;data:PChar;len:LongInt;encoding:tstringencoding;NewSection:Boolean): TAsmLabel;
       var
       var
         referencelab: TAsmLabel;
         referencelab: TAsmLabel;
         s: PChar;
         s: PChar;
@@ -59,6 +59,12 @@ uses
             current_asmdata.getdatalabel(referencelab);
             current_asmdata.getdatalabel(referencelab);
             list.concat(tai_label.create(referencelab));
             list.concat(tai_label.create(referencelab));
           end;
           end;
+        list.concat(tai_const.create_16bit(encoding));
+        list.concat(tai_const.create_16bit(1));
+{$ifdef cpu64bitaddr}
+        { dummy for alignment }
+        list.concat(tai_const.create_32bit(0));
+{$endif cpu64bitaddr}
         list.concat(tai_const.create_pint(-1));
         list.concat(tai_const.create_pint(-1));
         list.concat(tai_const.create_pint(len));
         list.concat(tai_const.create_pint(len));
         { make sure the string doesn't get dead stripped if the header is referenced }
         { make sure the string doesn't get dead stripped if the header is referenced }
@@ -75,7 +81,8 @@ uses
         list.concat(tai_string.create_pchar(s,len+1)); { terminating zero included }
         list.concat(tai_string.create_pchar(s,len+1)); { terminating zero included }
       end;
       end;
 
 
-    function emit_unicodestring_const(list:TAsmList;data:Pointer;Winlike:Boolean):TAsmLabel;
+
+    function emit_unicodestring_const(list:TAsmList;data:Pointer;encoding:tstringencoding;Winlike:Boolean):TAsmLabel;
       var
       var
         referencelab: TAsmLabel;
         referencelab: TAsmLabel;
         i, strlength: SizeInt;
         i, strlength: SizeInt;
@@ -90,11 +97,17 @@ uses
           end;
           end;
         strlength := getlengthwidestring(pcompilerwidestring(data));
         strlength := getlengthwidestring(pcompilerwidestring(data));
         if Winlike then
         if Winlike then
-           list.concat(Tai_const.Create_32bit(strlength*cwidechartype.size))
+          list.concat(Tai_const.Create_32bit(strlength*cwidechartype.size))
         else
         else
           begin
           begin
+            list.concat(tai_const.create_16bit(encoding));
+            list.concat(tai_const.create_16bit(2));
+    {$ifdef cpu64bitaddr}
+            { dummy for alignment }
+            list.concat(Tai_const.Create_32bit(0));
+    {$endif cpu64bitaddr}
             list.concat(Tai_const.Create_pint(-1));
             list.concat(Tai_const.Create_pint(-1));
-            list.concat(Tai_const.Create_pint(strlength*cwidechartype.size));
+            list.concat(Tai_const.Create_pint(strlength));
           end;
           end;
         { make sure the string doesn't get dead stripped if the header is referenced }
         { make sure the string doesn't get dead stripped if the header is referenced }
         if (target_info.system in systems_darwin) then
         if (target_info.system in systems_darwin) then

+ 12 - 10
compiler/assemble.pas

@@ -316,9 +316,9 @@ Implementation
            hs:=s;
            hs:=s;
            if hs[length(hs)] in ['/','\'] then
            if hs[length(hs)] in ['/','\'] then
             delete(hs,length(hs),1);
             delete(hs,length(hs),1);
-           {$I-}
+           {$push} {$I-}
             mkdir(hs);
             mkdir(hs);
-           {$I+}
+           {$pop}
            if ioresult<>0 then;
            if ioresult<>0 then;
          end;
          end;
       end;
       end;
@@ -401,9 +401,9 @@ Implementation
         else
         else
          begin
          begin
            assign(g,AsmFileName);
            assign(g,AsmFileName);
-           {$I-}
+           {$push} {$I-}
             erase(g);
             erase(g);
-           {$I+}
+           {$pop}
            if ioresult<>0 then;
            if ioresult<>0 then;
          end;
          end;
       end;
       end;
@@ -440,9 +440,9 @@ Implementation
         if outcnt>0 then
         if outcnt>0 then
          begin
          begin
            { suppress i/o error }
            { suppress i/o error }
-           {$i-}
+           {$push} {$I-}
            BlockWrite(outfile,outbuf,outcnt);
            BlockWrite(outfile,outbuf,outcnt);
-           {$i+}
+           {$pop}
            ioerror:=ioerror or (ioresult<>0);
            ioerror:=ioerror or (ioresult<>0);
            outcnt:=0;
            outcnt:=0;
          end;
          end;
@@ -574,9 +574,9 @@ Implementation
 {$endif}
 {$endif}
          begin
          begin
            Assign(outfile,AsmFileName);
            Assign(outfile,AsmFileName);
-           {$I-}
+           {$push} {$I-}
            Rewrite(outfile,1);
            Rewrite(outfile,1);
-           {$I+}
+           {$pop}
            if ioresult<>0 then
            if ioresult<>0 then
              begin
              begin
                ioerror:=true;
                ioerror:=true;
@@ -608,9 +608,9 @@ Implementation
            if ppufilename<>'' then
            if ppufilename<>'' then
             begin
             begin
               Assign(f,ppufilename);
               Assign(f,ppufilename);
-              {$I-}
+              {$push} {$I-}
               reset(f,1);
               reset(f,1);
-              {$I+}
+              {$pop}
               if ioresult=0 then
               if ioresult=0 then
                begin
                begin
                  FileAge := FileGetDate(GetFileHandle(f));
                  FileAge := FileGetDate(GetFileHandle(f));
@@ -1393,8 +1393,10 @@ Implementation
              ait_cutobject :
              ait_cutobject :
                if SmartAsm then
                if SmartAsm then
                 break;
                 break;
+{$ifdef TEST_WIN64_UNWIND}
              ait_seh_directive :
              ait_seh_directive :
                tai_seh_directive(hp).generate_code(objdata);
                tai_seh_directive(hp).generate_code(objdata);
+{$endif TEST_WIN64_UNWIND}
            end;
            end;
            hp:=Tai(hp.next);
            hp:=Tai(hp.next);
          end;
          end;

+ 47 - 7
compiler/ccharset.pas

@@ -13,9 +13,6 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
-
-{ this unit is included temporarily for 2.2 bootstrapping and can be
-  removed after the next release after 2.2.2 }
 {$mode objfpc}
 {$mode objfpc}
 unit ccharset;
 unit ccharset;
 
 
@@ -42,6 +39,7 @@ unit ccharset;
        punicodemap = ^tunicodemap;
        punicodemap = ^tunicodemap;
        tunicodemap = record
        tunicodemap = record
           cpname : string[20];
           cpname : string[20];
+          cp : word;
           map : punicodecharmapping;
           map : punicodecharmapping;
           lastchar : longint;
           lastchar : longint;
           next : punicodemap;
           next : punicodemap;
@@ -51,10 +49,15 @@ unit ccharset;
        tcp2unicode = class(tcsconvert)
        tcp2unicode = class(tcsconvert)
        end;
        end;
 
 
-    function loadunicodemapping(const cpname,f : string) : punicodemap;
+    const
+       DefaultSystemCodePage = 437;
+
+    function loadunicodemapping(const cpname,f : string; cp :word) : punicodemap;
     procedure registermapping(p : punicodemap);
     procedure registermapping(p : punicodemap);
     function getmap(const s : string) : punicodemap;
     function getmap(const s : string) : punicodemap;
+    function getmap(cp : word) : punicodemap;
     function mappingavailable(const s : string) : boolean;
     function mappingavailable(const s : string) : boolean;
+    function mappingavailable(cp :word) : boolean;
     function getunicode(c : char;p : punicodemap) : tunicodechar;
     function getunicode(c : char;p : punicodemap) : tunicodechar;
     function getascii(c : tunicodechar;p : punicodemap) : string;
     function getascii(c : tunicodechar;p : punicodemap) : string;
 
 
@@ -63,7 +66,7 @@ unit ccharset;
     var
     var
        mappings : punicodemap;
        mappings : punicodemap;
 
 
-    function loadunicodemapping(const cpname,f : string) : punicodemap;
+    function loadunicodemapping(const cpname,f : string; cp :word) : punicodemap;
 
 
       var
       var
          data : punicodecharmapping;
          data : punicodecharmapping;
@@ -158,6 +161,7 @@ unit ccharset;
          new(p);
          new(p);
          p^.lastchar:=lastchar;
          p^.lastchar:=lastchar;
          p^.cpname:=cpname;
          p^.cpname:=cpname;
+         p^.cp:=cp;
          p^.internalmap:=false;
          p^.internalmap:=false;
          p^.next:=nil;
          p^.next:=nil;
          p^.map:=data;
          p^.map:=data;
@@ -199,6 +203,36 @@ unit ccharset;
               hp:=hp^.next;
               hp:=hp^.next;
            end;
            end;
          getmap:=nil;
          getmap:=nil;
+      end;////////
+
+    function getmap(cp : word) : punicodemap;
+
+      var
+         hp : punicodemap;
+
+      const
+         mapcache : word = 0;
+         mapcachep : punicodemap = nil;
+
+      begin
+         if (mapcache=cp) and assigned(mapcachep) and (mapcachep^.cp=cp) then
+           begin
+              getmap:=mapcachep;
+              exit;
+           end;
+         hp:=mappings;
+         while assigned(hp) do
+           begin
+              if hp^.cp=cp then
+                begin
+                   getmap:=hp;
+                   mapcache:=cp;
+                   mapcachep:=hp;
+                   exit;
+                end;
+              hp:=hp^.next;
+           end;
+         getmap:=nil;
       end;
       end;
 
 
     function mappingavailable(const s : string) : boolean;
     function mappingavailable(const s : string) : boolean;
@@ -207,6 +241,12 @@ unit ccharset;
          mappingavailable:=getmap(s)<>nil;
          mappingavailable:=getmap(s)<>nil;
       end;
       end;
 
 
+    function mappingavailable(cp : word) : boolean;
+
+      begin
+         mappingavailable:=getmap(cp)<>nil;
+      end;
+
     function getunicode(c : char;p : punicodemap) : tunicodechar;
     function getunicode(c : char;p : punicodemap) : tunicodechar;
 
 
       begin
       begin
@@ -222,8 +262,8 @@ unit ccharset;
          i : longint;
          i : longint;
 
 
       begin
       begin
-         { at least map to space }
-         getascii:=#32;
+         { at least map to '?' }
+         getascii:=#63;
          for i:=0 to p^.lastchar do
          for i:=0 to p^.lastchar do
            if p^.map[i].unicode=c then
            if p^.map[i].unicode=c then
              begin
              begin

+ 159 - 6
compiler/cclasses.pas

@@ -479,13 +479,16 @@ type
        THashSet = class(TObject)
        THashSet = class(TObject)
        private
        private
          FCount: LongWord;
          FCount: LongWord;
-         FBucketCount: LongWord;
-         FBucket: PPHashSetItem;
          FOwnsObjects: Boolean;
          FOwnsObjects: Boolean;
          FOwnsKeys: Boolean;
          FOwnsKeys: Boolean;
          function Lookup(Key: Pointer; KeyLen: Integer; var Found: Boolean;
          function Lookup(Key: Pointer; KeyLen: Integer; var Found: Boolean;
            CanCreate: Boolean): PHashSetItem;
            CanCreate: Boolean): PHashSetItem;
          procedure Resize(NewCapacity: LongWord);
          procedure Resize(NewCapacity: LongWord);
+       protected
+         FBucket: PPHashSetItem;
+         FBucketCount: LongWord;
+         class procedure FreeItem(item:PHashSetItem); virtual;
+         class function SizeOfItem: Integer; virtual;
        public
        public
          constructor Create(InitSize: Integer; OwnKeys, OwnObjects: Boolean);
          constructor Create(InitSize: Integer; OwnKeys, OwnObjects: Boolean);
          destructor Destroy; override;
          destructor Destroy; override;
@@ -502,7 +505,40 @@ type
          { removes an entry, returns False if entry wasn't there }
          { removes an entry, returns False if entry wasn't there }
          function Remove(Entry: PHashSetItem): Boolean;
          function Remove(Entry: PHashSetItem): Boolean;
          property Count: LongWord read FCount;
          property Count: LongWord read FCount;
-      end;
+       end;
+
+{******************************************************************
+                             TTagHasSet
+*******************************************************************}
+       PPTagHashSetItem = ^PTagHashSetItem;
+       PTagHashSetItem = ^TTagHashSetItem;
+       TTagHashSetItem = record
+         Next: PTagHashSetItem;
+         Key: Pointer;
+         KeyLength: Integer;
+         HashValue: LongWord;
+         Data: TObject;
+         Tag: LongWord;
+       end;
+
+       TTagHashSet = class(THashSet)
+       private
+         function Lookup(Key: Pointer; KeyLen: Integer; Tag: LongWord; var Found: Boolean;
+           CanCreate: Boolean): PTagHashSetItem;
+       protected
+         class procedure FreeItem(item:PHashSetItem); override;
+         class function SizeOfItem: Integer; override;
+       public
+         { finds an entry by key }
+         function Find(Key: Pointer; KeyLen: Integer; Tag: LongWord): PTagHashSetItem; reintroduce;
+         { finds an entry, creates one if not exists }
+         function FindOrAdd(Key: Pointer; KeyLen: Integer; Tag: LongWord;
+           var Found: Boolean): PTagHashSetItem; reintroduce;
+         { finds an entry, creates one if not exists }
+         function FindOrAdd(Key: Pointer; KeyLen: Integer; Tag: LongWord): PTagHashSetItem; reintroduce;
+         { returns Data by given Key }
+         function Get(Key: Pointer; KeyLen: Integer; Tag: LongWord): TObject; reintroduce;
+       end;
 
 
 
 
 {******************************************************************
 {******************************************************************
@@ -536,6 +572,7 @@ type
 
 
     function FPHash(const s:shortstring):LongWord;
     function FPHash(const s:shortstring):LongWord;
     function FPHash(P: PChar; Len: Integer): LongWord;
     function FPHash(P: PChar; Len: Integer): LongWord;
+    function FPHash(P: PChar; Len: Integer; Tag: LongWord): LongWord;
 
 
 
 
 implementation
 implementation
@@ -1118,6 +1155,21 @@ end;
 {$pop}
 {$pop}
       end;
       end;
 
 
+    function FPHash(P: PChar; Len: Integer; Tag: LongWord): LongWord;
+      Var
+        pmax : pchar;
+      begin
+{$push}
+{$q-,r-}
+        result:=Tag;
+        pmax:=p+len;
+        while (p<pmax) do
+          begin
+            result:=LongWord(LongInt(result shl 5) - LongInt(result)) xor LongWord(P^);
+            inc(p);
+          end;
+{$pop}
+      end;
 
 
 procedure TFPHashList.RaiseIndexError(Index : Integer);
 procedure TFPHashList.RaiseIndexError(Index : Integer);
 begin
 begin
@@ -1222,8 +1274,10 @@ end;
 
 
 procedure TFPHashList.SetStrCapacity(NewCapacity: Integer);
 procedure TFPHashList.SetStrCapacity(NewCapacity: Integer);
 begin
 begin
+{$push}{$warnings off}
   If (NewCapacity < FStrCount) or (NewCapacity > MaxHashStrSize) then
   If (NewCapacity < FStrCount) or (NewCapacity > MaxHashStrSize) then
      Error (SListCapacityError, NewCapacity);
      Error (SListCapacityError, NewCapacity);
+{$pop}
   if NewCapacity = FStrCapacity then
   if NewCapacity = FStrCapacity then
     exit;
     exit;
   ReallocMem(FStrs, NewCapacity);
   ReallocMem(FStrs, NewCapacity);
@@ -2641,7 +2695,7 @@ end;
               item^.Data.Free;
               item^.Data.Free;
             if FOwnsKeys then
             if FOwnsKeys then
               FreeMem(item^.Key);
               FreeMem(item^.Key);
-            Dispose(item);
+            FreeItem(item);
             item := next;
             item := next;
           end;
           end;
         end;
         end;
@@ -2735,7 +2789,7 @@ end;
         i: Integer;
         i: Integer;
         e, n: PHashSetItem;
         e, n: PHashSetItem;
       begin
       begin
-        p := AllocMem(NewCapacity * sizeof(PHashSetItem));
+        p := AllocMem(NewCapacity * SizeOfItem);
         for i := 0 to FBucketCount-1 do
         for i := 0 to FBucketCount-1 do
           begin
           begin
             e := FBucket[i];
             e := FBucket[i];
@@ -2753,6 +2807,15 @@ end;
         FBucket := p;
         FBucket := p;
       end;
       end;
 
 
+    class procedure THashSet.FreeItem(item: PHashSetItem);
+      begin
+        Dispose(item);
+      end;
+
+    class function THashSet.SizeOfItem: Integer;
+      begin
+        Result := SizeOf(THashSetItem);
+      end;
 
 
     function THashSet.Remove(Entry: PHashSetItem): Boolean;
     function THashSet.Remove(Entry: PHashSetItem): Boolean;
       var
       var
@@ -2768,7 +2831,7 @@ end;
                   Entry^.Data.Free;
                   Entry^.Data.Free;
                 if FOwnsKeys then
                 if FOwnsKeys then
                   FreeMem(Entry^.Key);
                   FreeMem(Entry^.Key);
-                Dispose(Entry);
+                FreeItem(Entry);
                 Dec(FCount);
                 Dec(FCount);
                 Result := True;
                 Result := True;
                 Exit;
                 Exit;
@@ -2779,6 +2842,96 @@ end;
       end;
       end;
 
 
 
 
+{****************************************************************************
+                                ttaghashset
+****************************************************************************}
+
+    function TTagHashSet.Lookup(Key: Pointer; KeyLen: Integer;
+      Tag: LongWord; var Found: Boolean; CanCreate: Boolean): PTagHashSetItem;
+      var
+        Entry: PPTagHashSetItem;
+        h: LongWord;
+      begin
+        h := FPHash(Key, KeyLen, Tag);
+        Entry := @PPTagHashSetItem(FBucket)[h mod FBucketCount];
+        while Assigned(Entry^) and
+          not ((Entry^^.HashValue = h) and (Entry^^.KeyLength = KeyLen) and
+            (Entry^^.Tag = Tag) and (CompareByte(Entry^^.Key^, Key^, KeyLen) = 0)) do
+              Entry := @Entry^^.Next;
+        Found := Assigned(Entry^);
+        if Found or (not CanCreate) then
+          begin
+            Result := Entry^;
+            Exit;
+          end;
+        if FCount > FBucketCount then  { arbitrary limit, probably too high }
+          begin
+            { rehash and repeat search }
+            Resize(FBucketCount * 2);
+            Result := Lookup(Key, KeyLen, Tag, Found, CanCreate);
+          end
+        else
+          begin
+            New(Result);
+            if FOwnsKeys then
+            begin
+              GetMem(Result^.Key, KeyLen);
+              Move(Key^, Result^.Key^, KeyLen);
+            end
+            else
+              Result^.Key := Key;
+            Result^.KeyLength := KeyLen;
+            Result^.HashValue := h;
+            Result^.Tag := Tag;
+            Result^.Data := nil;
+            Result^.Next := nil;
+            Inc(FCount);
+            Entry^ := Result;
+          end;
+      end;
+
+    class procedure TTagHashSet.FreeItem(item: PHashSetItem);
+      begin
+        Dispose(PTagHashSetItem(item));
+      end;
+
+    class function TTagHashSet.SizeOfItem: Integer;
+      begin
+        Result := SizeOf(TTagHashSetItem);
+      end;
+
+    function TTagHashSet.Find(Key: Pointer; KeyLen: Integer; Tag: LongWord): PTagHashSetItem;
+      var
+        Dummy: Boolean;
+      begin
+        Result := Lookup(Key, KeyLen, Tag, Dummy, False);
+      end;
+
+    function TTagHashSet.FindOrAdd(Key: Pointer; KeyLen: Integer; Tag: LongWord;
+      var Found: Boolean): PTagHashSetItem;
+      begin
+        Result := Lookup(Key, KeyLen, Tag, Found, True);
+      end;
+
+    function TTagHashSet.FindOrAdd(Key: Pointer; KeyLen: Integer; Tag: LongWord): PTagHashSetItem;
+      var
+        Dummy: Boolean;
+      begin
+        Result := Lookup(Key, KeyLen, Tag, Dummy, True);
+      end;
+
+    function TTagHashSet.Get(Key: Pointer; KeyLen: Integer; Tag: LongWord): TObject;
+      var
+        e: PTagHashSetItem;
+        Dummy: Boolean;
+      begin
+        e := Lookup(Key, KeyLen, Tag, Dummy, False);
+        if Assigned(e) then
+          Result := e^.Data
+        else
+          Result := nil;
+      end;
+
 {****************************************************************************
 {****************************************************************************
                                 tbitset
                                 tbitset
 ****************************************************************************}
 ****************************************************************************}

+ 2 - 2
compiler/cfileutl.pas

@@ -684,9 +684,9 @@ end;
       begin
       begin
         if d[length(d)]=source_info.DirSep then
         if d[length(d)]=source_info.DirSep then
          Delete(d,length(d),1);
          Delete(d,length(d),1);
-        {$I-}
+        {$push}{$I-}
          rmdir(d);
          rmdir(d);
-        {$I+}
+        {$pop}
         RemoveDir:=(ioresult=0);
         RemoveDir:=(ioresult=0);
       end;
       end;
 
 

+ 42 - 34
compiler/cgobj.pas

@@ -523,6 +523,11 @@ unit cgobj;
 
 
           { initialize the pic/got register }
           { initialize the pic/got register }
           procedure g_maybe_got_init(list: TAsmList); virtual;
           procedure g_maybe_got_init(list: TAsmList); virtual;
+          { allocallcpuregisters, a_call_name, deallocallcpuregisters sequence }
+          procedure g_call(list: TAsmList; const s: string);
+          { Generate code to exit an unwind-protected region. The default implementation
+            produces a simple jump to destination label. }
+          procedure g_local_unwind(list: TAsmList; l: TAsmLabel);virtual;
         protected
         protected
           procedure get_subsetref_load_info(const sref: tsubsetreference; out loadsize: tcgsize; out extra_load: boolean);
           procedure get_subsetref_load_info(const sref: tsubsetreference; out loadsize: tcgsize; out extra_load: boolean);
           procedure a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister); virtual;
           procedure a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister); virtual;
@@ -1228,15 +1233,9 @@ implementation
                        some generic implementations
                        some generic implementations
 ****************************************************************************}
 ****************************************************************************}
 
 
-{$ifopt r+}
-{$define rangeon}
+{$push}
 {$r-}
 {$r-}
-{$endif}
-
-{$ifopt q+}
-{$define overflowon}
 {$q-}
 {$q-}
-{$endif}
 
 
    procedure tcg.a_load_subsetreg_reg(list : TAsmList; subsetsize, tosize: tcgsize; const sreg: tsubsetregister; destreg: tregister);
    procedure tcg.a_load_subsetreg_reg(list : TAsmList; subsetsize, tosize: tcgsize; const sreg: tsubsetregister; destreg: tregister);
      var
      var
@@ -2113,15 +2112,7 @@ implementation
       end;
       end;
 
 
 
 
-{$ifdef rangeon}
-{$r+}
-{$undef rangeon}
-{$endif}
-
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif}
+{$pop}
 
 
     { generic bit address calculation routines }
     { generic bit address calculation routines }
 
 
@@ -3641,18 +3632,27 @@ implementation
       begin
       begin
         cgpara1.init;
         cgpara1.init;
         cgpara2.init;
         cgpara2.init;
-        paramanager.getintparaloc(pocall_default,1,cgpara1);
-        paramanager.getintparaloc(pocall_default,2,cgpara2);
          if is_ansistring(t) or
          if is_ansistring(t) or
             is_widestring(t) or
             is_widestring(t) or
             is_unicodestring(t) or
             is_unicodestring(t) or
             is_interfacecom_or_dispinterface(t) or
             is_interfacecom_or_dispinterface(t) or
             is_dynamic_array(t) then
             is_dynamic_array(t) then
            a_load_const_ref(list,OS_ADDR,0,ref)
            a_load_const_ref(list,OS_ADDR,0,ref)
+         else if t.typ=variantdef then
+           begin
+             paramanager.getintparaloc(pocall_default,1,cgpara1);
+             a_loadaddr_ref_cgpara(list,ref,cgpara1);
+             paramanager.freecgpara(list,cgpara1);
+             allocallcpuregisters(list);
+             a_call_name(list,'FPC_VARIANT_INIT',false);
+             deallocallcpuregisters(list);
+           end
          else
          else
            begin
            begin
               if is_open_array(t) then
               if is_open_array(t) then
                 InternalError(201103052);
                 InternalError(201103052);
+              paramanager.getintparaloc(pocall_default,1,cgpara1);
+              paramanager.getintparaloc(pocall_default,2,cgpara2);
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
@@ -3674,8 +3674,6 @@ implementation
       begin
       begin
         cgpara1.init;
         cgpara1.init;
         cgpara2.init;
         cgpara2.init;
-        paramanager.getintparaloc(pocall_default,1,cgpara1);
-        paramanager.getintparaloc(pocall_default,2,cgpara2);
          if is_ansistring(t) or
          if is_ansistring(t) or
             is_widestring(t) or
             is_widestring(t) or
             is_unicodestring(t) or
             is_unicodestring(t) or
@@ -3684,10 +3682,21 @@ implementation
               g_decrrefcount(list,t,ref);
               g_decrrefcount(list,t,ref);
               a_load_const_ref(list,OS_ADDR,0,ref);
               a_load_const_ref(list,OS_ADDR,0,ref);
             end
             end
+         else if t.typ=variantdef then
+           begin
+             paramanager.getintparaloc(pocall_default,1,cgpara1);
+             a_loadaddr_ref_cgpara(list,ref,cgpara1);
+             paramanager.freecgpara(list,cgpara1);
+             allocallcpuregisters(list);
+             a_call_name(list,'FPC_VARIANT_CLEAR',false);
+             deallocallcpuregisters(list);
+           end
          else
          else
            begin
            begin
               if is_open_array(t) then
               if is_open_array(t) then
                 InternalError(201103051);
                 InternalError(201103051);
+              paramanager.getintparaloc(pocall_default,1,cgpara1);
+              paramanager.getintparaloc(pocall_default,2,cgpara2);
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
@@ -3790,14 +3799,9 @@ implementation
               { only optimize away if all bit patterns which fit in fromsize }
               { only optimize away if all bit patterns which fit in fromsize }
               { are valid for the todef                                      }
               { are valid for the todef                                      }
               begin
               begin
-{$ifopt Q+}
-{$define overflowon}
+{$push}
 {$Q-}
 {$Q-}
-{$endif}
-{$ifopt R+}
-{$define rangeon}
 {$R-}
 {$R-}
-{$endif}
                 if to_signed then
                 if to_signed then
                   begin
                   begin
                     { calculation of the low/high ranges must not overflow 64 bit
                     { calculation of the low/high ranges must not overflow 64 bit
@@ -3816,14 +3820,7 @@ implementation
                        (qword(hto) = (qword(-1) >> (64-(tosize * 8))) ) then
                        (qword(hto) = (qword(-1) >> (64-(tosize * 8))) ) then
                       exit
                       exit
                   end;
                   end;
-{$ifdef overflowon}
-{$Q+}
-{$undef overflowon}
-{$endif}
-{$ifdef rangeon}
-{$R+}
-{$undef rangeon}
-{$endif}
+{$pop}
               end
               end
           end;
           end;
 
 
@@ -4277,6 +4274,17 @@ implementation
       begin
       begin
       end;
       end;
 
 
+    procedure tcg.g_call(list: TAsmList;const s: string);
+      begin
+        allocallcpuregisters(list);
+        a_call_name(list,s,false);
+        deallocallcpuregisters(list);
+      end;
+
+    procedure tcg.g_local_unwind(list: TAsmList; l: TAsmLabel);
+      begin
+        a_jmp_always(list,l);
+      end;
 
 
     procedure tcg.a_loadmm_reg_reg(list: TAsmList; fromsize, tosize: tcgsize; reg1, reg2: tregister; shuffle: pmmshuffle);
     procedure tcg.a_loadmm_reg_reg(list: TAsmList; fromsize, tosize: tcgsize; reg1, reg2: tregister; shuffle: pmmshuffle);
       begin
       begin

+ 8 - 2
compiler/cmsgs.pas

@@ -188,9 +188,9 @@ begin
   getmem(buf,bufsize);
   getmem(buf,bufsize);
   { Read the message file }
   { Read the message file }
   assign(f,fn);
   assign(f,fn);
-  {$I-}
+  {$push}{$I-}
    reset(f);
    reset(f);
-  {$I+}
+  {$pop}
   if ioresult<>0 then
   if ioresult<>0 then
    begin
    begin
      WriteLn('*** PPC, can not open message file ',fn);
      WriteLn('*** PPC, can not open message file ',fn);
@@ -361,6 +361,12 @@ begin
       begin
       begin
         { skip _ }
         { skip _ }
         inc(hp1);
         inc(hp1);
+        { set default verbosity to off is '-' is found just after the '_' }
+        if hp1^='-' then
+         begin
+           msgstates[numpart]^[numidx]:=ms_off_global;
+           inc(hp1);
+         end;
         { put the address in the idx, the numbers are already checked }
         { put the address in the idx, the numbers are already checked }
         msgidx[numpart]^[numidx]:=hp1;
         msgidx[numpart]^[numidx]:=hp1;
       end;
       end;

+ 24 - 27
compiler/constexp.pas

@@ -32,9 +32,6 @@ interface
   {$R-}
   {$R-}
 {$endif}
 {$endif}
 
 
-{$ifopt q+}
-  {$define ena_q}
-{$endif}
 
 
 type  Tconstexprint=record
 type  Tconstexprint=record
         overflow:boolean;
         overflow:boolean;
@@ -165,9 +162,9 @@ begin
 
 
   {Try if the result fits in an int64.}
   {Try if the result fits in an int64.}
   if (a.signed) and (a.svalue<0) then
   if (a.signed) and (a.svalue<0) then
-    {$Q-}
+    {$push}{$Q-}
     sspace:=qword(high(int64))+qword(-a.svalue)
     sspace:=qword(high(int64))+qword(-a.svalue)
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else if not a.signed and (a.uvalue>qword(high(int64))) then
   else if not a.signed and (a.uvalue>qword(high(int64))) then
     goto try_qword
     goto try_qword
   else
   else
@@ -176,9 +173,9 @@ begin
   if sspace>=b then
   if sspace>=b then
     begin
     begin
       result.signed:=true;
       result.signed:=true;
-      {$Q-}
+      {$push} {$Q-}
       result.svalue:=a.svalue+int64(b);
       result.svalue:=a.svalue+int64(b);
-      {$ifdef ena_q}{$Q+}{$endif}
+      {$pop}
       exit;
       exit;
     end;
     end;
 
 
@@ -193,9 +190,9 @@ try_qword:
   if uspace>=b then
   if uspace>=b then
     begin
     begin
       result.signed:=false;
       result.signed:=false;
-      {$Q-}
+      {$push} {$Q-}
       result.uvalue:=a.uvalue+b;
       result.uvalue:=a.uvalue+b;
-      {$ifdef ena_q}{$Q+}{$endif}
+      {$pop}
       exit;
       exit;
     end;
     end;
   result.overflow:=true;
   result.overflow:=true;
@@ -214,9 +211,9 @@ begin
 
 
   {Try if the result fits in an int64.}
   {Try if the result fits in an int64.}
   if (a.signed) and (a.svalue<0) then
   if (a.signed) and (a.svalue<0) then
-    {$Q-}
+    {$push} {$Q-}
     sspace:=qword(a.svalue)+abs_low_int64
     sspace:=qword(a.svalue)+abs_low_int64
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else if not a.signed and (a.uvalue>qword(high(int64))) then
   else if not a.signed and (a.uvalue>qword(high(int64))) then
     goto try_qword
     goto try_qword
   else
   else
@@ -224,9 +221,9 @@ begin
   if sspace>=b then
   if sspace>=b then
     begin
     begin
       result.signed:=true;
       result.signed:=true;
-      {$Q-}
+      {$push} {$Q-}
       result.svalue:=a.svalue-int64(b);
       result.svalue:=a.svalue-int64(b);
-      {$ifdef ena_q}{$Q+}{$endif}
+      {$pop}
       exit;
       exit;
     end;
     end;
 
 
@@ -235,9 +232,9 @@ try_qword:
   if not(a.signed and (a.svalue<0)) and (a.uvalue>=b) then
   if not(a.signed and (a.svalue<0)) and (a.uvalue>=b) then
     begin
     begin
       result.signed:=false;
       result.signed:=false;
-      {$Q-}
+      {$push} {$Q-}
       result.uvalue:=a.uvalue-b;
       result.uvalue:=a.uvalue-b;
-      {$ifdef ena_q}{$Q+}{$endif}
+      {$pop}
       exit;
       exit;
     end;
     end;
 ov:
 ov:
@@ -253,9 +250,9 @@ begin
       exit;
       exit;
     end;
     end;
   if b.signed and (b.svalue<0) then
   if b.signed and (b.svalue<0) then
-    {$Q-}
+    {$push} {$Q-}
     result:=sub_from(a,qword(-b.svalue))
     result:=sub_from(a,qword(-b.svalue))
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else
   else
     result:=add_to(a,b.uvalue);
     result:=add_to(a,b.uvalue);
 end;
 end;
@@ -269,9 +266,9 @@ begin
       exit;
       exit;
     end;
     end;
   if b.signed and (b.svalue<0) then
   if b.signed and (b.svalue<0) then
-    {$Q-}
+    {$push} {$Q-}
     result:=add_to(a,qword(-b.svalue))
     result:=add_to(a,qword(-b.svalue))
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else
   else
     result:=sub_from(a,b.uvalue);
     result:=sub_from(a,b.uvalue);
 end;
 end;
@@ -348,16 +345,16 @@ begin
   result.overflow:=false;
   result.overflow:=false;
   sa:=a.signed and (a.svalue<0);
   sa:=a.signed and (a.svalue<0);
   if sa then
   if sa then
-    {$Q-}
+    {$push} {$Q-}
     aa:=qword(-a.svalue)
     aa:=qword(-a.svalue)
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else
   else
     aa:=a.uvalue;
     aa:=a.uvalue;
   sb:=b.signed and (b.svalue<0);
   sb:=b.signed and (b.svalue<0);
   if sb then
   if sb then
-    {$Q-}
+    {$push} {$Q-}
     bb:=qword(-b.svalue)
     bb:=qword(-b.svalue)
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else
   else
     bb:=b.uvalue;
     bb:=b.uvalue;
 
 
@@ -396,16 +393,16 @@ begin
   result.overflow:=false;
   result.overflow:=false;
   sa:=a.signed and (a.svalue<0);
   sa:=a.signed and (a.svalue<0);
   if sa then
   if sa then
-    {$Q-}
+    {$push} {$Q-}
     aa:=qword(-a.svalue)
     aa:=qword(-a.svalue)
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else
   else
     aa:=a.uvalue;
     aa:=a.uvalue;
   sb:=b.signed and (b.svalue<0);
   sb:=b.signed and (b.svalue<0);
   if sb then
   if sb then
-    {$Q-}
+    {$push} {$Q-}
     bb:=qword(-b.svalue)
     bb:=qword(-b.svalue)
-    {$ifdef ena_q}{$Q+}{$endif}
+    {$pop}
   else
   else
     bb:=b.uvalue;
     bb:=b.uvalue;
   if bb=0 then
   if bb=0 then

+ 2 - 1
compiler/cp1251.pas

@@ -6,7 +6,7 @@ unit cp1251;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,6 +270,7 @@ unit cp1251;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : 'cp1251';
        cpname : 'cp1251';
+       cp : 1251;
        map : @map;
        map : @map;
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 282 - 0
compiler/cp1252.pp

@@ -0,0 +1,282 @@
+{ This is an automatically created file, so don't edit it }
+unit CP1252;
+
+  interface
+
+  implementation
+
+  uses
+     {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
+
+  const
+     map : array[0..255] of tunicodecharmapping = (
+       (unicode : 0; flag : umf_noinfo; reserved: 0),
+       (unicode : 1; flag : umf_noinfo; reserved: 0),
+       (unicode : 2; flag : umf_noinfo; reserved: 0),
+       (unicode : 3; flag : umf_noinfo; reserved: 0),
+       (unicode : 4; flag : umf_noinfo; reserved: 0),
+       (unicode : 5; flag : umf_noinfo; reserved: 0),
+       (unicode : 6; flag : umf_noinfo; reserved: 0),
+       (unicode : 7; flag : umf_noinfo; reserved: 0),
+       (unicode : 8; flag : umf_noinfo; reserved: 0),
+       (unicode : 9; flag : umf_noinfo; reserved: 0),
+       (unicode : 10; flag : umf_noinfo; reserved: 0),
+       (unicode : 11; flag : umf_noinfo; reserved: 0),
+       (unicode : 12; flag : umf_noinfo; reserved: 0),
+       (unicode : 13; flag : umf_noinfo; reserved: 0),
+       (unicode : 14; flag : umf_noinfo; reserved: 0),
+       (unicode : 15; flag : umf_noinfo; reserved: 0),
+       (unicode : 16; flag : umf_noinfo; reserved: 0),
+       (unicode : 17; flag : umf_noinfo; reserved: 0),
+       (unicode : 18; flag : umf_noinfo; reserved: 0),
+       (unicode : 19; flag : umf_noinfo; reserved: 0),
+       (unicode : 20; flag : umf_noinfo; reserved: 0),
+       (unicode : 21; flag : umf_noinfo; reserved: 0),
+       (unicode : 22; flag : umf_noinfo; reserved: 0),
+       (unicode : 23; flag : umf_noinfo; reserved: 0),
+       (unicode : 24; flag : umf_noinfo; reserved: 0),
+       (unicode : 25; flag : umf_noinfo; reserved: 0),
+       (unicode : 26; flag : umf_noinfo; reserved: 0),
+       (unicode : 27; flag : umf_noinfo; reserved: 0),
+       (unicode : 28; flag : umf_noinfo; reserved: 0),
+       (unicode : 29; flag : umf_noinfo; reserved: 0),
+       (unicode : 30; flag : umf_noinfo; reserved: 0),
+       (unicode : 31; flag : umf_noinfo; reserved: 0),
+       (unicode : 32; flag : umf_noinfo; reserved: 0),
+       (unicode : 33; flag : umf_noinfo; reserved: 0),
+       (unicode : 34; flag : umf_noinfo; reserved: 0),
+       (unicode : 35; flag : umf_noinfo; reserved: 0),
+       (unicode : 36; flag : umf_noinfo; reserved: 0),
+       (unicode : 37; flag : umf_noinfo; reserved: 0),
+       (unicode : 38; flag : umf_noinfo; reserved: 0),
+       (unicode : 39; flag : umf_noinfo; reserved: 0),
+       (unicode : 40; flag : umf_noinfo; reserved: 0),
+       (unicode : 41; flag : umf_noinfo; reserved: 0),
+       (unicode : 42; flag : umf_noinfo; reserved: 0),
+       (unicode : 43; flag : umf_noinfo; reserved: 0),
+       (unicode : 44; flag : umf_noinfo; reserved: 0),
+       (unicode : 45; flag : umf_noinfo; reserved: 0),
+       (unicode : 46; flag : umf_noinfo; reserved: 0),
+       (unicode : 47; flag : umf_noinfo; reserved: 0),
+       (unicode : 48; flag : umf_noinfo; reserved: 0),
+       (unicode : 49; flag : umf_noinfo; reserved: 0),
+       (unicode : 50; flag : umf_noinfo; reserved: 0),
+       (unicode : 51; flag : umf_noinfo; reserved: 0),
+       (unicode : 52; flag : umf_noinfo; reserved: 0),
+       (unicode : 53; flag : umf_noinfo; reserved: 0),
+       (unicode : 54; flag : umf_noinfo; reserved: 0),
+       (unicode : 55; flag : umf_noinfo; reserved: 0),
+       (unicode : 56; flag : umf_noinfo; reserved: 0),
+       (unicode : 57; flag : umf_noinfo; reserved: 0),
+       (unicode : 58; flag : umf_noinfo; reserved: 0),
+       (unicode : 59; flag : umf_noinfo; reserved: 0),
+       (unicode : 60; flag : umf_noinfo; reserved: 0),
+       (unicode : 61; flag : umf_noinfo; reserved: 0),
+       (unicode : 62; flag : umf_noinfo; reserved: 0),
+       (unicode : 63; flag : umf_noinfo; reserved: 0),
+       (unicode : 64; flag : umf_noinfo; reserved: 0),
+       (unicode : 65; flag : umf_noinfo; reserved: 0),
+       (unicode : 66; flag : umf_noinfo; reserved: 0),
+       (unicode : 67; flag : umf_noinfo; reserved: 0),
+       (unicode : 68; flag : umf_noinfo; reserved: 0),
+       (unicode : 69; flag : umf_noinfo; reserved: 0),
+       (unicode : 70; flag : umf_noinfo; reserved: 0),
+       (unicode : 71; flag : umf_noinfo; reserved: 0),
+       (unicode : 72; flag : umf_noinfo; reserved: 0),
+       (unicode : 73; flag : umf_noinfo; reserved: 0),
+       (unicode : 74; flag : umf_noinfo; reserved: 0),
+       (unicode : 75; flag : umf_noinfo; reserved: 0),
+       (unicode : 76; flag : umf_noinfo; reserved: 0),
+       (unicode : 77; flag : umf_noinfo; reserved: 0),
+       (unicode : 78; flag : umf_noinfo; reserved: 0),
+       (unicode : 79; flag : umf_noinfo; reserved: 0),
+       (unicode : 80; flag : umf_noinfo; reserved: 0),
+       (unicode : 81; flag : umf_noinfo; reserved: 0),
+       (unicode : 82; flag : umf_noinfo; reserved: 0),
+       (unicode : 83; flag : umf_noinfo; reserved: 0),
+       (unicode : 84; flag : umf_noinfo; reserved: 0),
+       (unicode : 85; flag : umf_noinfo; reserved: 0),
+       (unicode : 86; flag : umf_noinfo; reserved: 0),
+       (unicode : 87; flag : umf_noinfo; reserved: 0),
+       (unicode : 88; flag : umf_noinfo; reserved: 0),
+       (unicode : 89; flag : umf_noinfo; reserved: 0),
+       (unicode : 90; flag : umf_noinfo; reserved: 0),
+       (unicode : 91; flag : umf_noinfo; reserved: 0),
+       (unicode : 92; flag : umf_noinfo; reserved: 0),
+       (unicode : 93; flag : umf_noinfo; reserved: 0),
+       (unicode : 94; flag : umf_noinfo; reserved: 0),
+       (unicode : 95; flag : umf_noinfo; reserved: 0),
+       (unicode : 96; flag : umf_noinfo; reserved: 0),
+       (unicode : 97; flag : umf_noinfo; reserved: 0),
+       (unicode : 98; flag : umf_noinfo; reserved: 0),
+       (unicode : 99; flag : umf_noinfo; reserved: 0),
+       (unicode : 100; flag : umf_noinfo; reserved: 0),
+       (unicode : 101; flag : umf_noinfo; reserved: 0),
+       (unicode : 102; flag : umf_noinfo; reserved: 0),
+       (unicode : 103; flag : umf_noinfo; reserved: 0),
+       (unicode : 104; flag : umf_noinfo; reserved: 0),
+       (unicode : 105; flag : umf_noinfo; reserved: 0),
+       (unicode : 106; flag : umf_noinfo; reserved: 0),
+       (unicode : 107; flag : umf_noinfo; reserved: 0),
+       (unicode : 108; flag : umf_noinfo; reserved: 0),
+       (unicode : 109; flag : umf_noinfo; reserved: 0),
+       (unicode : 110; flag : umf_noinfo; reserved: 0),
+       (unicode : 111; flag : umf_noinfo; reserved: 0),
+       (unicode : 112; flag : umf_noinfo; reserved: 0),
+       (unicode : 113; flag : umf_noinfo; reserved: 0),
+       (unicode : 114; flag : umf_noinfo; reserved: 0),
+       (unicode : 115; flag : umf_noinfo; reserved: 0),
+       (unicode : 116; flag : umf_noinfo; reserved: 0),
+       (unicode : 117; flag : umf_noinfo; reserved: 0),
+       (unicode : 118; flag : umf_noinfo; reserved: 0),
+       (unicode : 119; flag : umf_noinfo; reserved: 0),
+       (unicode : 120; flag : umf_noinfo; reserved: 0),
+       (unicode : 121; flag : umf_noinfo; reserved: 0),
+       (unicode : 122; flag : umf_noinfo; reserved: 0),
+       (unicode : 123; flag : umf_noinfo; reserved: 0),
+       (unicode : 124; flag : umf_noinfo; reserved: 0),
+       (unicode : 125; flag : umf_noinfo; reserved: 0),
+       (unicode : 126; flag : umf_noinfo; reserved: 0),
+       (unicode : 127; flag : umf_noinfo; reserved: 0),
+       (unicode : 8364; flag : umf_noinfo; reserved: 0),
+       (unicode : 65535; flag : umf_unused; reserved: 0),
+       (unicode : 8218; flag : umf_noinfo; reserved: 0),
+       (unicode : 402; flag : umf_noinfo; reserved: 0),
+       (unicode : 8222; flag : umf_noinfo; reserved: 0),
+       (unicode : 8230; flag : umf_noinfo; reserved: 0),
+       (unicode : 8224; flag : umf_noinfo; reserved: 0),
+       (unicode : 8225; flag : umf_noinfo; reserved: 0),
+       (unicode : 710; flag : umf_noinfo; reserved: 0),
+       (unicode : 8240; flag : umf_noinfo; reserved: 0),
+       (unicode : 352; flag : umf_noinfo; reserved: 0),
+       (unicode : 8249; flag : umf_noinfo; reserved: 0),
+       (unicode : 338; flag : umf_noinfo; reserved: 0),
+       (unicode : 65535; flag : umf_unused; reserved: 0),
+       (unicode : 381; flag : umf_noinfo; reserved: 0),
+       (unicode : 65535; flag : umf_unused; reserved: 0),
+       (unicode : 65535; flag : umf_unused; reserved: 0),
+       (unicode : 8216; flag : umf_noinfo; reserved: 0),
+       (unicode : 8217; flag : umf_noinfo; reserved: 0),
+       (unicode : 8220; flag : umf_noinfo; reserved: 0),
+       (unicode : 8221; flag : umf_noinfo; reserved: 0),
+       (unicode : 8226; flag : umf_noinfo; reserved: 0),
+       (unicode : 8211; flag : umf_noinfo; reserved: 0),
+       (unicode : 8212; flag : umf_noinfo; reserved: 0),
+       (unicode : 732; flag : umf_noinfo; reserved: 0),
+       (unicode : 8482; flag : umf_noinfo; reserved: 0),
+       (unicode : 353; flag : umf_noinfo; reserved: 0),
+       (unicode : 8250; flag : umf_noinfo; reserved: 0),
+       (unicode : 339; flag : umf_noinfo; reserved: 0),
+       (unicode : 65535; flag : umf_unused; reserved: 0),
+       (unicode : 382; flag : umf_noinfo; reserved: 0),
+       (unicode : 376; flag : umf_noinfo; reserved: 0),
+       (unicode : 160; flag : umf_noinfo; reserved: 0),
+       (unicode : 161; flag : umf_noinfo; reserved: 0),
+       (unicode : 162; flag : umf_noinfo; reserved: 0),
+       (unicode : 163; flag : umf_noinfo; reserved: 0),
+       (unicode : 164; flag : umf_noinfo; reserved: 0),
+       (unicode : 165; flag : umf_noinfo; reserved: 0),
+       (unicode : 166; flag : umf_noinfo; reserved: 0),
+       (unicode : 167; flag : umf_noinfo; reserved: 0),
+       (unicode : 168; flag : umf_noinfo; reserved: 0),
+       (unicode : 169; flag : umf_noinfo; reserved: 0),
+       (unicode : 170; flag : umf_noinfo; reserved: 0),
+       (unicode : 171; flag : umf_noinfo; reserved: 0),
+       (unicode : 172; flag : umf_noinfo; reserved: 0),
+       (unicode : 173; flag : umf_noinfo; reserved: 0),
+       (unicode : 174; flag : umf_noinfo; reserved: 0),
+       (unicode : 175; flag : umf_noinfo; reserved: 0),
+       (unicode : 176; flag : umf_noinfo; reserved: 0),
+       (unicode : 177; flag : umf_noinfo; reserved: 0),
+       (unicode : 178; flag : umf_noinfo; reserved: 0),
+       (unicode : 179; flag : umf_noinfo; reserved: 0),
+       (unicode : 180; flag : umf_noinfo; reserved: 0),
+       (unicode : 181; flag : umf_noinfo; reserved: 0),
+       (unicode : 182; flag : umf_noinfo; reserved: 0),
+       (unicode : 183; flag : umf_noinfo; reserved: 0),
+       (unicode : 184; flag : umf_noinfo; reserved: 0),
+       (unicode : 185; flag : umf_noinfo; reserved: 0),
+       (unicode : 186; flag : umf_noinfo; reserved: 0),
+       (unicode : 187; flag : umf_noinfo; reserved: 0),
+       (unicode : 188; flag : umf_noinfo; reserved: 0),
+       (unicode : 189; flag : umf_noinfo; reserved: 0),
+       (unicode : 190; flag : umf_noinfo; reserved: 0),
+       (unicode : 191; flag : umf_noinfo; reserved: 0),
+       (unicode : 192; flag : umf_noinfo; reserved: 0),
+       (unicode : 193; flag : umf_noinfo; reserved: 0),
+       (unicode : 194; flag : umf_noinfo; reserved: 0),
+       (unicode : 195; flag : umf_noinfo; reserved: 0),
+       (unicode : 196; flag : umf_noinfo; reserved: 0),
+       (unicode : 197; flag : umf_noinfo; reserved: 0),
+       (unicode : 198; flag : umf_noinfo; reserved: 0),
+       (unicode : 199; flag : umf_noinfo; reserved: 0),
+       (unicode : 200; flag : umf_noinfo; reserved: 0),
+       (unicode : 201; flag : umf_noinfo; reserved: 0),
+       (unicode : 202; flag : umf_noinfo; reserved: 0),
+       (unicode : 203; flag : umf_noinfo; reserved: 0),
+       (unicode : 204; flag : umf_noinfo; reserved: 0),
+       (unicode : 205; flag : umf_noinfo; reserved: 0),
+       (unicode : 206; flag : umf_noinfo; reserved: 0),
+       (unicode : 207; flag : umf_noinfo; reserved: 0),
+       (unicode : 208; flag : umf_noinfo; reserved: 0),
+       (unicode : 209; flag : umf_noinfo; reserved: 0),
+       (unicode : 210; flag : umf_noinfo; reserved: 0),
+       (unicode : 211; flag : umf_noinfo; reserved: 0),
+       (unicode : 212; flag : umf_noinfo; reserved: 0),
+       (unicode : 213; flag : umf_noinfo; reserved: 0),
+       (unicode : 214; flag : umf_noinfo; reserved: 0),
+       (unicode : 215; flag : umf_noinfo; reserved: 0),
+       (unicode : 216; flag : umf_noinfo; reserved: 0),
+       (unicode : 217; flag : umf_noinfo; reserved: 0),
+       (unicode : 218; flag : umf_noinfo; reserved: 0),
+       (unicode : 219; flag : umf_noinfo; reserved: 0),
+       (unicode : 220; flag : umf_noinfo; reserved: 0),
+       (unicode : 221; flag : umf_noinfo; reserved: 0),
+       (unicode : 222; flag : umf_noinfo; reserved: 0),
+       (unicode : 223; flag : umf_noinfo; reserved: 0),
+       (unicode : 224; flag : umf_noinfo; reserved: 0),
+       (unicode : 225; flag : umf_noinfo; reserved: 0),
+       (unicode : 226; flag : umf_noinfo; reserved: 0),
+       (unicode : 227; flag : umf_noinfo; reserved: 0),
+       (unicode : 228; flag : umf_noinfo; reserved: 0),
+       (unicode : 229; flag : umf_noinfo; reserved: 0),
+       (unicode : 230; flag : umf_noinfo; reserved: 0),
+       (unicode : 231; flag : umf_noinfo; reserved: 0),
+       (unicode : 232; flag : umf_noinfo; reserved: 0),
+       (unicode : 233; flag : umf_noinfo; reserved: 0),
+       (unicode : 234; flag : umf_noinfo; reserved: 0),
+       (unicode : 235; flag : umf_noinfo; reserved: 0),
+       (unicode : 236; flag : umf_noinfo; reserved: 0),
+       (unicode : 237; flag : umf_noinfo; reserved: 0),
+       (unicode : 238; flag : umf_noinfo; reserved: 0),
+       (unicode : 239; flag : umf_noinfo; reserved: 0),
+       (unicode : 240; flag : umf_noinfo; reserved: 0),
+       (unicode : 241; flag : umf_noinfo; reserved: 0),
+       (unicode : 242; flag : umf_noinfo; reserved: 0),
+       (unicode : 243; flag : umf_noinfo; reserved: 0),
+       (unicode : 244; flag : umf_noinfo; reserved: 0),
+       (unicode : 245; flag : umf_noinfo; reserved: 0),
+       (unicode : 246; flag : umf_noinfo; reserved: 0),
+       (unicode : 247; flag : umf_noinfo; reserved: 0),
+       (unicode : 248; flag : umf_noinfo; reserved: 0),
+       (unicode : 249; flag : umf_noinfo; reserved: 0),
+       (unicode : 250; flag : umf_noinfo; reserved: 0),
+       (unicode : 251; flag : umf_noinfo; reserved: 0),
+       (unicode : 252; flag : umf_noinfo; reserved: 0),
+       (unicode : 253; flag : umf_noinfo; reserved: 0),
+       (unicode : 254; flag : umf_noinfo; reserved: 0),
+       (unicode : 255; flag : umf_noinfo; reserved: 0)
+     );
+
+     unicodemap : tunicodemap = (
+       cpname : 'CP1252';
+       cp : 1252;
+       map : @map;
+       lastchar : 255;
+       next : nil;
+       internalmap : true
+     );
+
+  begin
+     registermapping(@unicodemap)
+  end.

+ 2 - 1
compiler/cp437.pas

@@ -6,7 +6,7 @@ unit cp437;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,6 +270,7 @@ unit cp437;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : 'cp437';
        cpname : 'cp437';
+       cp : 437;
        map : @map[0];
        map : @map[0];
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 2 - 1
compiler/cp850.pas

@@ -6,7 +6,7 @@ unit cp850;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,6 +270,7 @@ unit cp850;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : 'cp850';
        cpname : 'cp850';
+       cp : 850;
        map : @map[0];
        map : @map[0];
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 2 - 1
compiler/cp866.pas

@@ -6,7 +6,7 @@ unit cp866;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,6 +270,7 @@ unit cp866;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : 'cp866';
        cpname : 'cp866';
+       cp : 866;
        map : @map;
        map : @map;
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 2 - 1
compiler/cp8859_1.pas

@@ -6,7 +6,7 @@ unit cp8859_1;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+    {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,6 +270,7 @@ unit cp8859_1;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : '8859-1';
        cpname : '8859-1';
+       cp : 28591;
        map : @map[0];
        map : @map[0];
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 2 - 1
compiler/cp8859_5.pas

@@ -6,7 +6,7 @@ unit cp8859_5;
   implementation
   implementation
 
 
   uses
   uses
-     {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2};
+     {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif};
 
 
   const
   const
      map : array[0..255] of tunicodecharmapping = (
      map : array[0..255] of tunicodecharmapping = (
@@ -270,6 +270,7 @@ unit cp8859_5;
 
 
      unicodemap : tunicodemap = (
      unicodemap : tunicodemap = (
        cpname : '8859-5';
        cpname : '8859-5';
+       cp : 28595;
        map : @map;
        map : @map;
        lastchar : 255;
        lastchar : 255;
        next : nil;
        next : nil;

+ 191 - 0
compiler/cpid.pas

@@ -0,0 +1,191 @@
+{
+    Copyright (c) 2008 by Florian Klaempfl
+
+    Basic stuff for encoding sensitive strings
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ****************************************************************************
+}
+unit cpid;
+
+
+{$i fpcdefs.inc}
+
+  interface
+
+    type
+      TEncodingEntry = record
+        id : TStringEncoding;
+        name : Ansistring;
+      end;
+
+    const Encodings : array[0..150] of TEncodingEntry = (
+      id : 037; name : 'IBM037';
+      id : 437; name : 'IBM437';
+      id : 500; name : 'IBM500';
+      id : 708; name : 'ASMO-708';
+      id : 709; name : 'ASMO-449+';
+      id : 710; name : 'Arabic';
+      id : 720; name : 'DOS-720';
+      id : 737; name : 'ibm737';
+      id : 775; name : 'ibm775';
+      id : 850; name : 'ibm850';
+      id : 852; name : 'ibm852';
+      id : 855; name : 'IBM855';
+      id : 857; name : 'ibm857';
+      id : 858; name : 'IBM00858';
+      id : 860; name : 'IBM860';
+      id : 861; name : 'ibm861';
+      id : 862; name : 'DOS-862';
+      id : 863; name : 'IBM863';
+      id : 864; name : 'IBM864';
+      id : 865; name : 'IBM865';
+      id : 866; name : 'cp866'';;
+      id : 869; name : 'ibm869';
+      id : 870; name : 'IBM870';
+      id : 874; name : 'windows-874';
+      id : 875; name : 'cp875';
+      id : 932; name : 'shift_jis';
+      id : 936; name : 'gb2312';
+      id : 949; name : 'ks_c_5601-1987';
+      id : 950; name : 'big5';
+      id : 1026; name : 'IBM1026';
+      id : 1047; name : 'IBM01047';
+      id : 1140; name : 'IBM01140';
+      id : 1141; name : 'IBM01141';
+      id : 1142; name : 'IBM01142';
+      id : 1143; name : 'IBM01143';
+      id : 1144; name : 'IBM01144';
+      id : 1145; name : 'IBM01145';
+      id : 1146; name : 'IBM01146';
+      id : 1147; name : 'IBM01147';
+      id : 1148; name : 'IBM01148';
+      id : 1149; name : 'IBM01149';
+      id : 1200; name : 'utf-16';
+      id : 1201; name : 'unicodeFFFE';
+      id : 1250; name : 'windows-1250';
+      id : 1251; name : 'windows-1251';
+      id : 1252; name : 'windows-1252';
+      id : 1253; name : 'windows-1253';
+      id : 1254; name : 'windows-1254';
+      id : 1255; name : 'windows-1255';
+      id : 1256; name : 'windows-1256';
+      id : 1257; name : 'windows-1257';
+      id : 1258; name : 'windows-1258';
+      id : 1361; name : 'Johab';
+      id : 10000; name : 'macintosh';
+      id : 10001; name : 'x-mac-japanese';
+      id : 10002; name : 'x-mac-chinesetrad';
+      id : 10003; name : 'x-mac-korean';
+      id : 10004; name : 'x-mac-arabic';
+      id : 10005; name : 'x-mac-hebrew';
+      id : 10006; name : 'x-mac-greek';
+      id : 10007; name : 'x-mac-cyrillic';
+      id : 10008; name : 'x-mac-chinesesimp';
+      id : 10010; name : 'x-mac-romanian';
+      id : 10017; name : 'x-mac-ukrainian';
+      id : 10021; name : 'x-mac-thai';
+      id : 10029; name : 'x-mac-ce';
+      id : 10079; name : 'x-mac-icelandic';
+      id : 10081; name : 'x-mac-turkish';
+      id : 10082; name : 'x-mac-croatian';
+      id : 12000; name : 'utf-32';
+      id : 12001; name : 'utf-32BE';
+      id : 20000; name : 'x-Chinese_CNS';
+      id : 20001; name : 'x-cp20001';
+      id : 20002; name : 'x_Chinese-Eten';
+      id : 20003; name : 'x-cp20003';
+      id : 20004; name : 'x-cp20004';
+      id : 20005; name : 'x-cp20005';
+      id : 20105; name : 'x-IA5';
+      id : 20106; name : 'x-IA5-German';
+      id : 20107; name : 'x-IA5-Swedish';
+      id : 20108; name : 'x-IA5-Norwegian';
+      id : 20127; name : 'us-ascii';
+      id : 20261; name : 'x-cp20261';
+      id : 20269; name : 'x-cp20269';
+      id : 20273; name : 'IBM273';
+      id : 20277; name : 'IBM277';
+      id : 20278; name : 'IBM278';
+      id : 20280; name : 'IBM280';
+      id : 20284; name : 'IBM284';
+      id : 20285; name : 'IBM285';
+      id : 20290; name : 'IBM290';
+      id : 20297; name : 'IBM297';
+      id : 20420; name : 'IBM420';
+      id : 20423; name : 'IBM423';
+      id : 20424; name : 'IBM424';
+      id : 20833; name : 'x-EBCDIC-KoreanExtended';
+      id : 20838; name : 'IBM-Thai';
+      id : 20866; name : 'koi8-r';
+      id : 20871; name : 'IBM871';
+      id : 20880; name : 'IBM880';
+      id : 20905; name : 'IBM905';
+      id : 20924; name : 'IBM00924';
+      id : 20932; name : 'EUC-JP';
+      id : 20936; name : 'x-cp20936';
+      id : 20949; name : 'x-cp20949';
+      id : 21025; name : 'cp1025';
+      id : 21866; name : 'koi8-u';
+      id : 28591; name : 'iso-8859-1';
+      id : 28592; name : 'iso-8859-2';
+      id : 28593; name : 'iso-8859-3';
+      id : 28594; name : 'iso-8859-4';
+      id : 28595; name : 'iso-8859-5';
+      id : 28596; name : 'iso-8859-6';
+      id : 28597; name : 'iso-8859-7';
+      id : 28598; name : 'iso-8859-8';
+      id : 28599; name : 'iso-8859-9';
+      id : 28603; name : 'iso-8859-13';
+      id : 28605; name : 'iso-8859-15';
+      id : 29001; name : 'x-Europa';
+      id : 38598; name : 'iso-8859-8-i';
+      id : 50220; name : 'iso-2022-jp';
+      id : 50221; name : 'csISO2022JP';
+      id : 50222; name : 'iso-2022-jp';
+      id : 50225; name : 'iso-2022-kr';
+      id : 50227; name : 'x-cp50227';
+      id : 50229; name : 'ISO 2022';
+      { not unique
+      id : 50930; name : 'EBCDIC
+      id : 50931; name : 'EBCDIC
+      id : 50933; name : 'EBCDIC
+      id : 50935; name : 'EBCDIC
+      id : 50936; name : 'EBCDIC
+      id : 50937; name : 'EBCDIC
+      id : 50939; name : 'EBCDIC
+      }
+      id : 51932; name : 'euc-jp';
+      id : 51936; name : 'EUC-CN';
+      id : 51949; name : 'euc-kr';
+      id : 51950; name : 'EUC';
+      id : 52936; name : 'hz-gb-2312';
+      id : 54936; name : 'GB18030';
+      id : 57002; name : 'x-iscii-de';
+      id : 57003; name : 'x-iscii-be';
+      id : 57004; name : 'x-iscii-ta';
+      id : 57005; name : 'x-iscii-te';
+      id : 57006; name : 'x-iscii-as';
+      id : 57007; name : 'x-iscii-or';
+      id : 57008; name : 'x-iscii-ka';
+      id : 57009; name : 'x-iscii-ma';
+      id : 57010; name : 'x-iscii-gu';
+      id : 57011; name : 'x-iscii-pa';
+      id : 65000; name : 'utf-7';
+      id : 65001; name : 'utf-8');
+
+  implementation
+
+end.

+ 11 - 7
compiler/cresstr.pas

@@ -37,7 +37,11 @@ uses
    symconst,symtype,symdef,symsym,
    symconst,symtype,symdef,symsym,
    verbose,fmodule,ppu,
    verbose,fmodule,ppu,
    aasmbase,aasmtai,aasmdata,
    aasmbase,aasmtai,aasmdata,
-   aasmcpu,asmutils;
+   aasmcpu,
+{$if FPC_FULLVERSION<20700}
+   ccharset,
+{$endif}
+   asmutils;
 
 
     Type
     Type
       { These are used to form a singly-linked list, ordered by hash value }
       { These are used to form a singly-linked list, ordered by hash value }
@@ -146,7 +150,7 @@ uses
           make_mangledname('RESSTR',current_module.localsymtable,'START'),AT_DATA,0));
           make_mangledname('RESSTR',current_module.localsymtable,'START'),AT_DATA,0));
 
 
         { Write unitname entry }
         { Write unitname entry }
-        namelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],@current_module.localsymtable.name^[1],length(current_module.localsymtable.name^),False);
+        namelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],@current_module.localsymtable.name^[1],length(current_module.localsymtable.name^),getansistringcodepage,False);
         current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(namelab));
         current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(namelab));
         current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil));
         current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil));
         current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil));
         current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil));
@@ -162,12 +166,12 @@ uses
             new_section(current_asmdata.asmlists[al_const],sec_rodata,make_mangledname('RESSTR',current_module.localsymtable,'d_'+r.name),sizeof(pint));
             new_section(current_asmdata.asmlists[al_const],sec_rodata,make_mangledname('RESSTR',current_module.localsymtable,'d_'+r.name),sizeof(pint));
             { Write default value }
             { Write default value }
             if assigned(R.value) and (R.len<>0) then
             if assigned(R.value) and (R.len<>0) then
-              valuelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],R.Value,R.Len,False)
+              valuelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],R.Value,R.Len,getansistringcodepage,False)
             else
             else
               valuelab:=nil;
               valuelab:=nil;
             { Append the name as a ansistring. }
             { Append the name as a ansistring. }
             current_asmdata.asmlists[al_const].concat(cai_align.Create(const_align(sizeof(pint))));
             current_asmdata.asmlists[al_const].concat(cai_align.Create(const_align(sizeof(pint))));
-            namelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],@R.Name[1],length(R.name),False);
+            namelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],@R.Name[1],length(R.name),getansistringcodepage,False);
 
 
             {
             {
               Resourcestring index:
               Resourcestring index:
@@ -203,7 +207,7 @@ uses
         { Update: the Mac OS X 10.6 linker orders data that needs to be    }
         { Update: the Mac OS X 10.6 linker orders data that needs to be    }
         { relocated before all other data, so make this data relocatable,  }
         { relocated before all other data, so make this data relocatable,  }
         { otherwise the end label won't be moved with the rest             }
         { otherwise the end label won't be moved with the rest             }
-        if (target_info.system in systems_darwin) then   
+        if (target_info.system in systems_darwin) then
           current_asmdata.asmlists[al_resourcestrings].concat(Tai_const.create_sym(endsymlab));
           current_asmdata.asmlists[al_resourcestrings].concat(Tai_const.create_sym(endsymlab));
       end;
       end;
 
 
@@ -229,9 +233,9 @@ uses
         ResFileName:=ChangeFileExt(current_module.ppufilename^,'.rst');
         ResFileName:=ChangeFileExt(current_module.ppufilename^,'.rst');
         message1 (general_i_writingresourcefile,ExtractFileName(ResFileName));
         message1 (general_i_writingresourcefile,ExtractFileName(ResFileName));
         Assign(F,ResFileName);
         Assign(F,ResFileName);
-        {$i-}
+        {$push}{$i-}
         Rewrite(f);
         Rewrite(f);
-        {$i+}
+        {$pop}
         If IOresult<>0 then
         If IOresult<>0 then
           begin
           begin
             message1(general_e_errorwritingresourcefile,ResFileName);
             message1(general_e_errorwritingresourcefile,ResFileName);

+ 10 - 10
compiler/cstreams.pas

@@ -371,9 +371,9 @@ begin
   If Mode=fmcreate then
   If Mode=fmcreate then
     begin
     begin
       system.assign(FHandle,AFileName);
       system.assign(FHandle,AFileName);
-      {$I-}
+      {$push} {$I-}
        system.rewrite(FHandle,1);
        system.rewrite(FHandle,1);
-      {$I+}
+      {$pop}
       CStreamError:=IOResult;
       CStreamError:=IOResult;
     end
     end
   else
   else
@@ -381,9 +381,9 @@ begin
       oldfilemode:=filemode;
       oldfilemode:=filemode;
       filemode:=$40 or Mode;
       filemode:=$40 or Mode;
       system.assign(FHandle,AFileName);
       system.assign(FHandle,AFileName);
-      {$I-}
+      {$push} {$I-}
        system.reset(FHandle,1);
        system.reset(FHandle,1);
-      {$I+}
+      {$pop}
       CStreamError:=IOResult;
       CStreamError:=IOResult;
       filemode:=oldfilemode;
       filemode:=oldfilemode;
     end;
     end;
@@ -392,9 +392,9 @@ end;
 
 
 destructor TCFileStream.Destroy;
 destructor TCFileStream.Destroy;
 begin
 begin
-  {$I-}
+  {$push} {$I-}
    System.Close(FHandle);
    System.Close(FHandle);
-  {$I+}
+  {$pop}
   CStreamError:=IOResult;
   CStreamError:=IOResult;
 end;
 end;
 
 
@@ -417,10 +417,10 @@ end;
 
 
 Procedure TCFileStream.SetSize(NewSize: Longint);
 Procedure TCFileStream.SetSize(NewSize: Longint);
 begin
 begin
-  {$I-}
+  {$push} {$I-}
    System.Seek(FHandle,NewSize);
    System.Seek(FHandle,NewSize);
    System.Truncate(FHandle);
    System.Truncate(FHandle);
-  {$I+}
+  {$pop}
   CStreamError:=IOResult;
   CStreamError:=IOResult;
 end;
 end;
 
 
@@ -429,7 +429,7 @@ function TCFileStream.Seek(Offset: Longint; Origin: Word): Longint;
 var
 var
   l : longint;
   l : longint;
 begin
 begin
-  {$I-}
+  {$push} {$I-}
    case Origin of
    case Origin of
      soFromBeginning :
      soFromBeginning :
        begin
        begin
@@ -451,7 +451,7 @@ begin
          System.Seek(FHandle,l);
          System.Seek(FHandle,l);
        end;
        end;
    end;
    end;
-  {$I+}
+  {$pop}
   CStreamError:=IOResult;
   CStreamError:=IOResult;
   Result:=l;
   Result:=l;
 end;
 end;

+ 19 - 10
compiler/dbgdwarf.pas

@@ -364,6 +364,7 @@ interface
         procedure appendsym_absolute(list:TAsmList;sym:tabsolutevarsym);override;
         procedure appendsym_absolute(list:TAsmList;sym:tabsolutevarsym);override;
         procedure appendsym_property(list:TAsmList;sym:tpropertysym);override;
         procedure appendsym_property(list:TAsmList;sym:tpropertysym);override;
 
 
+        function symdebugname(sym:tsym): String; virtual;
         function symname(sym:tsym): String; virtual;
         function symname(sym:tsym): String; virtual;
         procedure append_visibility(vis: tvisibility);
         procedure append_visibility(vis: tvisibility);
 
 
@@ -415,7 +416,7 @@ interface
         procedure appenddef_undefined(list:TAsmList;def:tundefineddef); override;
         procedure appenddef_undefined(list:TAsmList;def:tundefineddef); override;
         procedure appenddef_variant(list:TAsmList;def:tvariantdef); override;
         procedure appenddef_variant(list:TAsmList;def:tvariantdef); override;
 
 
-        function symname(sym:tsym): String; override;
+        function symdebugname(sym:tsym): String; override;
       public
       public
         function  dwarf_version: Word; override;
         function  dwarf_version: Word; override;
       end;
       end;
@@ -2044,7 +2045,7 @@ implementation
         procentry      : string;
         procentry      : string;
         cc             : Tdwarf_calling_convention;
         cc             : Tdwarf_calling_convention;
         st             : tsymtable;
         st             : tsymtable;
-        vmtindexnr     : pint;
+        vmtoffset      : pint;
         in_currentunit : boolean;
         in_currentunit : boolean;
       begin
       begin
         { only write debug info for procedures defined in the current module,
         { only write debug info for procedures defined in the current module,
@@ -2128,10 +2129,12 @@ implementation
             { Element number in the vmt (needs to skip stuff coming before the
             { Element number in the vmt (needs to skip stuff coming before the
               actual method addresses in the vmt, so we use vmtmethodoffset()
               actual method addresses in the vmt, so we use vmtmethodoffset()
               and then divide by sizeof(pint)).  }
               and then divide by sizeof(pint)).  }
-            vmtindexnr:=tobjectdef(def.owner.defowner).vmtmethodoffset(def.extnumber) div sizeof(pint);
-            append_attribute(DW_AT_vtable_elem_location,DW_FORM_block1,[1+LengthUleb128(vmtindexnr)]);
+            vmtoffset:=tobjectdef(def.owner.defowner).vmtmethodoffset(def.extnumber);
+            append_attribute(DW_AT_vtable_elem_location,DW_FORM_block1,[3+LengthUleb128(vmtoffset)]);
+            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_deref)));
             current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_constu)));
             current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_constu)));
-            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_uleb128bit(vmtindexnr));
+            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_uleb128bit(vmtoffset));
+            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus)));
           end;
           end;
 
 
         { accessibility: public/private/protected }
         { accessibility: public/private/protected }
@@ -2761,6 +2764,12 @@ implementation
       end;
       end;
 
 
 
 
+    function TDebugInfoDwarf.symdebugname(sym: tsym): String;
+    begin
+      result := sym.name;
+    end;
+
+
     procedure TDebugInfoDwarf.appendsym_type(list:TAsmList;sym: ttypesym);
     procedure TDebugInfoDwarf.appendsym_type(list:TAsmList;sym: ttypesym);
       begin
       begin
         { just queue the def if needed, beforeappenddef will
         { just queue the def if needed, beforeappenddef will
@@ -3209,9 +3218,9 @@ implementation
         else if (ds_dwarf_method_class_prefix in current_settings.debugswitches) and
         else if (ds_dwarf_method_class_prefix in current_settings.debugswitches) and
                 (sym.typ=procsym) and
                 (sym.typ=procsym) and
                 (tprocsym(sym).owner.symtabletype in [objectsymtable,recordsymtable]) then
                 (tprocsym(sym).owner.symtabletype in [objectsymtable,recordsymtable]) then
-          result:=tprocsym(sym).owner.name^+'__'+sym.name
+          result:=tprocsym(sym).owner.name^+'__'+symdebugname(sym)
         else
         else
-          result:=sym.name;
+          result:=symdebugname(sym);
       end;
       end;
 
 
 
 
@@ -3469,12 +3478,12 @@ implementation
               current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(def_dwarf_class_struct_lab(def),0));
               current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(def_dwarf_class_struct_lab(def),0));
           end;
           end;
         if assigned(objectname) then
         if assigned(objectname) then
-          append_entry(DW_TAG_structure_type,true,[
+          append_entry(DW_TAG_class_type,true,[
             DW_AT_name,DW_FORM_string,objectname^+#0,
             DW_AT_name,DW_FORM_string,objectname^+#0,
             DW_AT_byte_size,DW_FORM_udata,tobjectsymtable(def.symtable).datasize
             DW_AT_byte_size,DW_FORM_udata,tobjectsymtable(def.symtable).datasize
             ])
             ])
         else
         else
-          append_entry(DW_TAG_structure_type,true,[
+          append_entry(DW_TAG_class_type,true,[
             DW_AT_byte_size,DW_FORM_udata,tobjectsymtable(def.symtable).datasize
             DW_AT_byte_size,DW_FORM_udata,tobjectsymtable(def.symtable).datasize
             ]);
             ]);
         { Apple-specific tag that identifies it as an Objective-C class }
         { Apple-specific tag that identifies it as an Objective-C class }
@@ -4086,7 +4095,7 @@ implementation
         Result:=3;
         Result:=3;
       end;
       end;
 
 
-    function TDebugInfoDwarf3.symname(sym: tsym): String;
+    function TDebugInfoDwarf3.symdebugname(sym: tsym): String;
       begin
       begin
         Result:=sym.realname;
         Result:=sym.realname;
       end;
       end;

+ 64 - 12
compiler/defcmp.pas

@@ -43,7 +43,9 @@ interface
           cpo_ignoreuniv,
           cpo_ignoreuniv,
           cpo_warn_incompatible_univ,
           cpo_warn_incompatible_univ,
           cpo_ignorevarspez,          // ignore parameter access type
           cpo_ignorevarspez,          // ignore parameter access type
-          cpo_ignoreframepointer      // ignore frame pointer parameter (for assignment-compatibility of global procedures to nested procvars)
+          cpo_ignoreframepointer,     // ignore frame pointer parameter (for assignment-compatibility of global procedures to nested procvars)
+          cpo_compilerproc,
+          cpo_rtlproc
        );
        );
 
 
        tcompare_paras_options = set of tcompare_paras_option;
        tcompare_paras_options = set of tcompare_paras_option;
@@ -333,27 +335,66 @@ implementation
                      { Constant string }
                      { Constant string }
                      if (fromtreetype=stringconstn) then
                      if (fromtreetype=stringconstn) then
                       begin
                       begin
-                        if (tstringdef(def_from).stringtype=tstringdef(def_to).stringtype) then
+                        if (tstringdef(def_from).stringtype=tstringdef(def_to).stringtype) and
+                           ((tstringdef(def_from).stringtype<>st_ansistring) or
+                            (tstringdef(def_from).encoding=tstringdef(def_to).encoding)
+                           ) then
                           eq:=te_equal
                           eq:=te_equal
                         else
                         else
                          begin
                          begin
                            doconv:=tc_string_2_string;
                            doconv:=tc_string_2_string;
-                           { Don't prefer conversions from widestring to a
-                             normal string as we can lose information }
-                           if (tstringdef(def_from).stringtype in [st_widestring,st_unicodestring]) and
-                             not (tstringdef(def_to).stringtype in [st_widestring,st_unicodestring]) then
-                             eq:=te_convert_l3
-                           else if tstringdef(def_to).stringtype in [st_widestring,st_unicodestring] then
-                             eq:=te_convert_l2
+                           if (tstringdef(def_from).stringtype = st_ansistring) and
+                              (tstringdef(def_to).stringtype = st_ansistring) then
+                             if (tstringdef(def_to).encoding=globals.CP_UTF8) then
+                               eq:=te_convert_l1
+                             else
+                               eq:=te_convert_l2
                            else
                            else
-                             eq:=te_equal;
+                            begin
+                              { Don't prefer conversions from widestring to a
+                                normal string as we can lose information }
+                              if (tstringdef(def_from).stringtype in [st_widestring,st_unicodestring]) and
+                                not (tstringdef(def_to).stringtype in [st_widestring,st_unicodestring]) then
+                                eq:=te_convert_l3
+                              else if tstringdef(def_to).stringtype in [st_widestring,st_unicodestring] then
+                                eq:=te_convert_l2
+                              else
+                                eq:=te_convert_l1;
+                            end;
                          end;
                          end;
                       end
                       end
+                     else if (tstringdef(def_from).stringtype=tstringdef(def_to).stringtype) and
+                             (tstringdef(def_from).stringtype=st_ansistring) then 
+                      begin
+                        { don't convert ansistrings if any conditions is true:
+                          1) same encoding
+                          2) from explicit codepage ansistring to ansistring and vice versa
+                          3) from any ansistring to rawbytestring }
+                        if (tstringdef(def_from).encoding=tstringdef(def_to).encoding) or
+                           ((tstringdef(def_to).encoding=0) and (tstringdef(def_from).encoding=getansistringcodepage)) or
+                           ((tstringdef(def_to).encoding=getansistringcodepage) and (tstringdef(def_from).encoding=0)) or
+                           (tstringdef(def_to).encoding=globals.CP_NONE) then
+                         begin
+                           eq:=te_equal;
+                         end
+                        else
+                         begin        
+                           doconv := tc_string_2_string;
+                           if (tstringdef(def_to).encoding=globals.CP_UTF8) then 
+                             eq:=te_convert_l1
+                           else
+                             eq:=te_convert_l2;
+                         end 
+                      end          
                      else
                      else
-                     { Same string type, for shortstrings also the length must match }
+                     { same string type ? }
                       if (tstringdef(def_from).stringtype=tstringdef(def_to).stringtype) and
                       if (tstringdef(def_from).stringtype=tstringdef(def_to).stringtype) and
+                        { for shortstrings also the length must match }
                          ((tstringdef(def_from).stringtype<>st_shortstring) or
                          ((tstringdef(def_from).stringtype<>st_shortstring) or
-                          (tstringdef(def_from).len=tstringdef(def_to).len)) then
+                          (tstringdef(def_from).len=tstringdef(def_to).len)) and
+                         { for ansi- and unicodestrings also the encoding must match }
+                         (not(tstringdef(def_from).stringtype in [st_ansistring,st_unicodestring]) or
+                          (tstringdef(def_from).encoding=tstringdef(def_to).encoding)) then
                         eq:=te_equal
                         eq:=te_equal
                      else
                      else
                        begin
                        begin
@@ -1781,6 +1822,17 @@ implementation
                  if not equal_constsym(tconstsym(currpara1.defaultconstsym),tconstsym(currpara2.defaultconstsym)) then
                  if not equal_constsym(tconstsym(currpara1.defaultconstsym),tconstsym(currpara2.defaultconstsym)) then
                    exit;
                    exit;
                end;
                end;
+              if not(cpo_compilerproc in cpoptions) and
+                 not(cpo_rtlproc in cpoptions) and
+                 is_ansistring(currpara1.vardef) and
+                 is_ansistring(currpara2.vardef) and
+                 (tstringdef(currpara1.vardef).encoding<>tstringdef(currpara2.vardef).encoding) and
+                 ((tstringdef(currpara1.vardef).encoding=globals.CP_NONE) or
+                  (tstringdef(currpara2.vardef).encoding=globals.CP_NONE)
+                 ) then
+                eq:=te_convert_l1;
+              if eq<lowesteq then
+                lowesteq:=eq;
               inc(i1);
               inc(i1);
               inc(i2);
               inc(i2);
               if cpo_ignorehidden in cpoptions then
               if cpo_ignorehidden in cpoptions then

+ 11 - 0
compiler/defutil.pas

@@ -169,6 +169,9 @@ interface
     {# Returns true if p is an ansi string type }
     {# Returns true if p is an ansi string type }
     function is_ansistring(p : tdef) : boolean;
     function is_ansistring(p : tdef) : boolean;
 
 
+    {# Returns true if p is an ansi string type with codepage 0 }
+    function is_rawbytestring(p : tdef) : boolean;
+
     {# Returns true if p is a long string type }
     {# Returns true if p is a long string type }
     function is_longstring(p : tdef) : boolean;
     function is_longstring(p : tdef) : boolean;
 
 
@@ -617,6 +620,14 @@ implementation
                         (tstringdef(p).stringtype=st_ansistring);
                         (tstringdef(p).stringtype=st_ansistring);
       end;
       end;
 
 
+    { true if p is an ansi string def with codepage CP_NONE }
+    function is_rawbytestring(p : tdef) : boolean;
+      begin
+        is_rawbytestring:=(p.typ=stringdef) and
+                       (tstringdef(p).stringtype=st_ansistring) and
+                       (tstringdef(p).encoding=globals.CP_NONE);
+      end;
+
     { true if p is an long string def }
     { true if p is an long string def }
     function is_longstring(p : tdef) : boolean;
     function is_longstring(p : tdef) : boolean;
       begin
       begin

+ 3 - 0
compiler/fmodule.pas

@@ -143,6 +143,7 @@ interface
         checkforwarddefs,
         checkforwarddefs,
         deflist,
         deflist,
         symlist       : TFPObjectList;
         symlist       : TFPObjectList;
+        ansistrdef    : tobject; { an ansistring def redefined for the current module }
         wpoinfo       : tunitwpoinfobase; { whole program optimization-related information that is generated during the current run for this unit }
         wpoinfo       : tunitwpoinfobase; { whole program optimization-related information that is generated during the current run for this unit }
         globalsymtable,           { pointer to the global symtable of this unit }
         globalsymtable,           { pointer to the global symtable of this unit }
         localsymtable : TSymtable;{ pointer to the local symtable of this unit }
         localsymtable : TSymtable;{ pointer to the local symtable of this unit }
@@ -523,6 +524,7 @@ implementation
         derefdataintflen:=0;
         derefdataintflen:=0;
         deflist:=TFPObjectList.Create(false);
         deflist:=TFPObjectList.Create(false);
         symlist:=TFPObjectList.Create(false);
         symlist:=TFPObjectList.Create(false);
+        ansistrdef:=nil;
         wpoinfo:=nil;
         wpoinfo:=nil;
         checkforwarddefs:=TFPObjectList.Create(false);
         checkforwarddefs:=TFPObjectList.Create(false);
         extendeddefs := TFPHashObjectList.Create(true);
         extendeddefs := TFPHashObjectList.Create(true);
@@ -634,6 +636,7 @@ implementation
         derefdata.free;
         derefdata.free;
         deflist.free;
         deflist.free;
         symlist.free;
         symlist.free;
+        ansistrdef:=nil;
         wpoinfo.free;
         wpoinfo.free;
         checkforwarddefs.free;
         checkforwarddefs.free;
         globalsymtable.free;
         globalsymtable.free;

+ 9 - 0
compiler/fpcdefs.inc

@@ -59,6 +59,7 @@
   {$define SUPPORT_MMX}
   {$define SUPPORT_MMX}
   {$define cpumm}
   {$define cpumm}
   {$define fewintregisters}
   {$define fewintregisters}
+  {$define cpurox}
 {$endif i386}
 {$endif i386}
 
 
 {$ifdef x86_64}
 {$ifdef x86_64}
@@ -70,6 +71,7 @@
   {$define cpufloat128}
   {$define cpufloat128}
   {$define cputargethasfixedstack}
   {$define cputargethasfixedstack}
   {$define cpumm}
   {$define cpumm}
+  {$define cpurox}
 {$endif x86_64}
 {$endif x86_64}
 
 
 {$ifdef alpha}
 {$ifdef alpha}
@@ -92,6 +94,7 @@
   {$define cpuflags}
   {$define cpuflags}
   {$define cputargethasfixedstack}
   {$define cputargethasfixedstack}
   {$define cpumm}
   {$define cpumm}
+  {$define cpurox}
 {$endif powerpc}
 {$endif powerpc}
 
 
 {$ifdef powerpc64}
 {$ifdef powerpc64}
@@ -100,6 +103,7 @@
   {$define cpuflags}
   {$define cpuflags}
   {$define cputargethasfixedstack}
   {$define cputargethasfixedstack}
   {$define cpumm}
   {$define cpumm}
+  {$define cpurox}
 {$endif powerpc64}
 {$endif powerpc64}
 
 
 {$ifdef arm}
 {$ifdef arm}
@@ -109,7 +113,12 @@
   {$define cpuflags}
   {$define cpuflags}
   {$define cpufpemu}
   {$define cpufpemu}
   {$define cpuneedsdiv32helper}
   {$define cpuneedsdiv32helper}
+  {$define cpurox}
   {$define cputargethasfixedstack}
   {$define cputargethasfixedstack}
+  { default to armel }
+  {$if not(defined(CPUARM)) and not(defined(CPUARMEB)) and not(defined(FPC_OARM)) and not(defined(FPC_ARMEB))}
+    {$define FPC_ARMEL}
+  {$endif}
   { inherit FPC_ARMEL? }
   { inherit FPC_ARMEL? }
   {$if defined(CPUARMEL) and not(defined(FPC_OARM)) and not(defined(FPC_ARMEB))}
   {$if defined(CPUARMEL) and not(defined(FPC_OARM)) and not(defined(FPC_ARMEB))}
     {$define FPC_ARMEL}
     {$define FPC_ARMEL}

+ 2 - 2
compiler/gendef.pas

@@ -106,9 +106,9 @@ begin
     Exit;
     Exit;
 { open file }
 { open file }
   assign(t,fname);
   assign(t,fname);
-  {$I+}
+  {$push}{$I-}
    rewrite(t);
    rewrite(t);
-  {$I-}
+  {$pop}
   if ioresult<>0 then
   if ioresult<>0 then
    exit;
    exit;
   case target_info.system of
   case target_info.system of

+ 7 - 4
compiler/globals.pas

@@ -53,6 +53,7 @@ interface
           m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
           m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal,m_default_ansistring,
           m_out,m_default_para,m_duplicate_names,m_hintdirective,
           m_out,m_default_para,m_duplicate_names,m_hintdirective,
           m_property,m_default_inline,m_except,m_advanced_records];
           m_property,m_default_inline,m_except,m_advanced_records];
+       delphiunicodemodeswitches = delphimodeswitches + [m_systemcodepage];
        fpcmodeswitches =
        fpcmodeswitches =
          [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
          [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
           m_cvar_support,m_initfinal,m_hintdirective,
           m_cvar_support,m_initfinal,m_hintdirective,
@@ -102,10 +103,12 @@ interface
        MathPiExtended : textendedrec = (bytes : (64,0,201,15,218,162,33,104,194,53));
        MathPiExtended : textendedrec = (bytes : (64,0,201,15,218,162,33,104,194,53));
 {$endif FPC_LITTLE_ENDIAN}
 {$endif FPC_LITTLE_ENDIAN}
 {$endif}
 {$endif}
+       CP_UTF8 = 65001;
+       CP_UTF16 = 1200;
+       CP_NONE  = 65535;
 
 
-    type
-       tcodepagestring = string[20];
 
 
+    type
        { this is written to ppus during token recording for generics so it must be packed }
        { this is written to ppus during token recording for generics so it must be packed }
        tsettings = packed record
        tsettings = packed record
          alignment       : talignmentinfo;
          alignment       : talignmentinfo;
@@ -133,7 +136,7 @@ interface
          asmmode         : tasmmode;
          asmmode         : tasmmode;
          interfacetype   : tinterfacetypes;
          interfacetype   : tinterfacetypes;
          defproccall     : tproccalloption;
          defproccall     : tproccalloption;
-         sourcecodepage  : tcodepagestring;
+         sourcecodepage  : tstringencoding;
 
 
          minfpconstprec  : tfloattype;
          minfpconstprec  : tfloattype;
 
 
@@ -426,7 +429,7 @@ interface
         asmmode : asmmode_standard;
         asmmode : asmmode_standard;
         interfacetype : it_interfacecom;
         interfacetype : it_interfacecom;
         defproccall : pocall_default;
         defproccall : pocall_default;
-        sourcecodepage : '8859-1';
+        sourcecodepage : 28591;
         minfpconstprec : s32real;
         minfpconstprec : s32real;
 
 
         disabledircache : false;
         disabledircache : false;

+ 31 - 24
compiler/globtype.pas

@@ -139,7 +139,7 @@ interface
          cs_support_c_operators,
          cs_support_c_operators,
          { generation }
          { generation }
          cs_profile,cs_debuginfo,cs_compilesystem,
          cs_profile,cs_debuginfo,cs_compilesystem,
-         cs_lineinfo,cs_implicit_exceptions,
+         cs_lineinfo,cs_implicit_exceptions,cs_explicit_codepage,
          { linking }
          { linking }
          cs_create_smart,cs_create_dynamic,cs_create_pic,
          cs_create_smart,cs_create_dynamic,cs_create_pic,
          { browser switches are back }
          { browser switches are back }
@@ -295,7 +295,8 @@ interface
          m_nested_procvars,     { support nested procedural variables }
          m_nested_procvars,     { support nested procedural variables }
          m_non_local_goto,      { support non local gotos (like iso pascal) }
          m_non_local_goto,      { support non local gotos (like iso pascal) }
          m_advanced_records,    { advanced record syntax with visibility sections, methods and properties }
          m_advanced_records,    { advanced record syntax with visibility sections, methods and properties }
-         m_isolike_unary_minus  { unary minus like in iso pascal: same precedence level as binary minus/plus }
+         m_isolike_unary_minus, { unary minus like in iso pascal: same precedence level as binary minus/plus }
+         m_systemcodepage       { use system codepage as compiler codepage by default, emit ansistrings with system codepage }
        );
        );
        tmodeswitches = set of tmodeswitch;
        tmodeswitches = set of tmodeswitch;
 
 
@@ -427,7 +428,8 @@ interface
          'NESTEDPROCVARS',
          'NESTEDPROCVARS',
          'NONLOCALGOTO',
          'NONLOCALGOTO',
          'ADVANCEDRECORDS',
          'ADVANCEDRECORDS',
-         'ISOUNARYMINUS');
+         'ISOUNARYMINUS',
+         'SYSTEMCODEPAGE');
 
 
 
 
      type
      type
@@ -464,7 +466,9 @@ interface
          { dfa was generated for this proc }
          { dfa was generated for this proc }
          pi_dfaavailable,
          pi_dfaavailable,
          { subroutine contains interprocedural used labels }
          { subroutine contains interprocedural used labels }
-         pi_has_interproclabel
+         pi_has_interproclabel,
+         { subroutine has unwind info (win64) }
+         pi_has_unwind_info
        );
        );
        tprocinfoflags=set of tprocinfoflag;
        tprocinfoflags=set of tprocinfoflag;
 
 
@@ -481,26 +485,26 @@ interface
       TRADirection = (rad_forward, rad_backwards, rad_backwards_reinit);
       TRADirection = (rad_forward, rad_backwards, rad_backwards_reinit);
 
 
     type
     type
-       TIDString = string[maxidlen];
-
-       tnormalset = set of byte; { 256 elements set }
-       pnormalset = ^tnormalset;
-
-       pboolean   = ^boolean;
-       pdouble    = ^double;
-       pbyte      = ^byte;
-       pword      = ^word;
-       plongint   = ^longint;
-       plongintarray = plongint;
-
-       pfileposinfo = ^tfileposinfo;
-       tfileposinfo = record
-         { if types of column or fileindex are changed, modify tcompilerppufile.putposinfo }
-         line      : longint;
-         column    : word;
-         fileindex : word;
-         moduleindex : word;
-       end;
+      TIDString = string[maxidlen];
+
+      tnormalset = set of byte; { 256 elements set }
+      pnormalset = ^tnormalset;
+
+      pboolean   = ^boolean;
+      pdouble    = ^double;
+      pbyte      = ^byte;
+      pword      = ^word;
+      plongint   = ^longint;
+      plongintarray = plongint;
+
+      pfileposinfo = ^tfileposinfo;
+      tfileposinfo = record
+        { if types of column or fileindex are changed, modify tcompilerppufile.putposinfo }
+        line      : longint;
+        column    : word;
+        fileindex : word;
+        moduleindex : word;
+      end;
 
 
   {$ifndef xFPC}
   {$ifndef xFPC}
     type
     type
@@ -513,6 +517,9 @@ interface
       end;
       end;
   {$endif}
   {$endif}
 
 
+       tstringencoding = Word;
+       tcodepagestring = string[20];
+
     const
     const
        { link options }
        { link options }
        link_none    = $0;
        link_none    = $0;

+ 28 - 17
compiler/htypechk.pas

@@ -1156,14 +1156,11 @@ implementation
                else
                else
                  begin
                  begin
                    { 1. if it returns a pointer and we've found a deref,
                    { 1. if it returns a pointer and we've found a deref,
-                     2. if it returns a class or record and a subscription or with is found
+                     2. if it returns a class and a subscription or with is found
                      3. if the address is needed of a field (subscriptn, vecn) }
                      3. if the address is needed of a field (subscriptn, vecn) }
                    if (gotpointer and gotderef) or
                    if (gotpointer and gotderef) or
                       (gotstring and gotvec) or
                       (gotstring and gotvec) or
-                      (
-                       (gotclass or gotrecord) and
-                       (gotsubscript)
-                      ) or
+                      (gotclass and gotsubscript) or
                       (
                       (
                         (gotvec and gotdynarray)
                         (gotvec and gotdynarray)
                       ) or
                       ) or
@@ -1484,7 +1481,7 @@ implementation
                         begin
                         begin
                           { allow p^:= constructions with p is const parameter }
                           { allow p^:= constructions with p is const parameter }
                           if gotderef or gotdynarray or (Valid_Const in opts) or
                           if gotderef or gotdynarray or (Valid_Const in opts) or
-                            (nf_isinternal_ignoreconst in tloadnode(hp).flags) then
+                            (loadnf_isinternal_ignoreconst in tloadnode(hp).loadnodeflags) then
                             result:=true
                             result:=true
                           else
                           else
                             if report_errors then
                             if report_errors then
@@ -1890,12 +1887,11 @@ implementation
                   not hasoverload then
                   not hasoverload then
                  break;
                  break;
              end;
              end;
-           if is_objectpascal_helper(structdef) then
+           if is_objectpascal_helper(structdef) and
+              (tobjectdef(structdef).typ in [recorddef,objectdef]) then
              begin
              begin
-               if not assigned(tobjectdef(structdef).extendeddef) then
-                 Internalerror(2011062601);
                { search methods in the extended type as well }
                { search methods in the extended type as well }
-               srsym:=tprocsym(tobjectdef(structdef).extendeddef.symtable.FindWithHash(hashedid));
+               srsym:=tprocsym(tabstractrecorddef(tobjectdef(structdef).extendeddef).symtable.FindWithHash(hashedid));
                if assigned(srsym) and
                if assigned(srsym) and
                   { Delphi allows hiding a property by a procedure with the same name }
                   { Delphi allows hiding a property by a procedure with the same name }
                   (srsym.typ=procsym) then
                   (srsym.typ=procsym) then
@@ -1997,6 +1993,7 @@ implementation
         st    : TSymtable;
         st    : TSymtable;
         contextstructdef : tabstractrecorddef;
         contextstructdef : tabstractrecorddef;
         ProcdefOverloadList : TFPObjectList;
         ProcdefOverloadList : TFPObjectList;
+        cpoptions : tcompare_paras_options;
       begin
       begin
         FCandidateProcs:=nil;
         FCandidateProcs:=nil;
 
 
@@ -2086,11 +2083,16 @@ implementation
                ) then
                ) then
               begin
               begin
                 { don't add duplicates, only compare visible parameters for the user }
                 { don't add duplicates, only compare visible parameters for the user }
+                cpoptions:=[cpo_ignorehidden];
+                if (po_compilerproc in pd.procoptions) then
+                  cpoptions:=cpoptions+[cpo_compilerproc];
+                if (po_rtlproc in pd.procoptions) then
+                  cpoptions:=cpoptions+[cpo_rtlproc];
                 found:=false;
                 found:=false;
                 hp:=FCandidateProcs;
                 hp:=FCandidateProcs;
                 while assigned(hp) do
                 while assigned(hp) do
                   begin
                   begin
-                    if (compare_paras(hp^.data.paras,pd.paras,cp_value_equal_const,[cpo_ignorehidden])>=te_equal) and
+                    if (compare_paras(hp^.data.paras,pd.paras,cp_value_equal_const,cpoptions)>=te_equal) and
                        (not(po_objc in pd.procoptions) or
                        (not(po_objc in pd.procoptions) or
                         (pd.messageinf.str^=hp^.data.messageinf.str^)) then
                         (pd.messageinf.str^=hp^.data.messageinf.str^)) then
                       begin
                       begin
@@ -2238,13 +2240,12 @@ implementation
         cdoptions : tcompare_defs_options;
         cdoptions : tcompare_defs_options;
         n : tnode;
         n : tnode;
 
 
-    {$ifopt r+}{$define ena_r}{$r-}{$endif}
-    {$ifopt q+}{$define ena_q}{$q-}{$endif}
+    {$push}
+    {$r-}
+    {$q-}
       const
       const
         inf=1.0/0.0;
         inf=1.0/0.0;
-    {$ifdef ena_r}{$r+}{$endif}
-    {$ifdef ena_q}{$q+}{$endif}
-
+    {$pop}
       begin
       begin
         cdoptions:=[cdo_check_operator];
         cdoptions:=[cdo_check_operator];
         if FAllowVariant then
         if FAllowVariant then
@@ -2412,7 +2413,17 @@ implementation
               else
               else
               { generic type comparision }
               { generic type comparision }
                begin
                begin
-                 eq:=compare_defs_ext(def_from,def_to,currpt.left.nodetype,convtype,pdoper,cdoptions);
+                 if not(po_compilerproc in hp^.data.procoptions) and
+                    not(po_rtlproc in hp^.data.procoptions) and
+                    is_ansistring(currpara.vardef) and
+                    is_ansistring(currpt.left.resultdef) and
+                    (tstringdef(currpara.vardef).encoding<>tstringdef(currpt.left.resultdef).encoding) and
+                    ((tstringdef(currpara.vardef).encoding=globals.CP_NONE) or
+                     (tstringdef(currpt.left.resultdef).encoding=globals.CP_NONE)
+                    ) then
+                   eq:=te_convert_l1
+                 else
+                   eq:=compare_defs_ext(def_from,def_to,currpt.left.nodetype,convtype,pdoper,cdoptions);
 
 
                  { when the types are not equal we need to check
                  { when the types are not equal we need to check
                    some special case for parameter passing }
                    some special case for parameter passing }

+ 10 - 21
compiler/i386/daopt386.pas

@@ -689,10 +689,8 @@ begin
 end;
 end;
 
 
 
 
-{$ifdef q+}
+{$push}
 {$q-}
 {$q-}
-{$define overflowon}
-{$endif q+}
 
 
 // checks whether a write to r2 of size "size" contains address r1
 // checks whether a write to r2 of size "size" contains address r1
 function refsoverlapping(const r1, r2: treference; size1, size2: tcgsize): boolean;
 function refsoverlapping(const r1, r2: treference; size1, size2: tcgsize): boolean;
@@ -710,18 +708,17 @@ begin
     (r1.relsymbol = r2.relsymbol);
     (r1.relsymbol = r2.relsymbol);
 end;
 end;
 
 
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif overflowon}
+{$pop}
 
 
 
 
 function isgp32reg(supreg: tsuperregister): boolean;
 function isgp32reg(supreg: tsuperregister): boolean;
 {Checks if the register is a 32 bit general purpose register}
 {Checks if the register is a 32 bit general purpose register}
 begin
 begin
   isgp32reg := false;
   isgp32reg := false;
+{$push}{$warnings off}
   if (supreg >= RS_EAX) and (supreg <= RS_EBX) then
   if (supreg >= RS_EAX) and (supreg <= RS_EBX) then
     isgp32reg := true
     isgp32reg := true
+{$pop}
 end;
 end;
 
 
 
 
@@ -1380,10 +1377,12 @@ procedure DestroyReg(p1: ptaiprop; supreg: tsuperregister; doincState:Boolean);
  action (e.g. this register holds the contents of a variable and the value
  action (e.g. this register holds the contents of a variable and the value
  of the variable in memory is changed) }
  of the variable in memory is changed) }
 begin
 begin
+{$push}{$warnings off}
   { the following happens for fpu registers }
   { the following happens for fpu registers }
   if (supreg < low(NrOfInstrSinceLastMod)) or
   if (supreg < low(NrOfInstrSinceLastMod)) or
      (supreg > high(NrOfInstrSinceLastMod)) then
      (supreg > high(NrOfInstrSinceLastMod)) then
     exit;
     exit;
+{$pop}
   NrOfInstrSinceLastMod[supreg] := 0;
   NrOfInstrSinceLastMod[supreg] := 0;
   with p1^.regs[supreg] do
   with p1^.regs[supreg] do
     begin
     begin
@@ -1723,10 +1722,8 @@ begin
   RefInSequence := TmpResult
   RefInSequence := TmpResult
 end;
 end;
 
 
-{$ifdef q+}
+{$push}
 {$q-}
 {$q-}
-{$define overflowon}
-{$endif q+}
 // checks whether a write to r2 of size "size" contains address r1
 // checks whether a write to r2 of size "size" contains address r1
 function arrayrefsoverlapping(const r1, r2: treference; size1, size2: tcgsize): Boolean;
 function arrayrefsoverlapping(const r1, r2: treference; size1, size2: tcgsize): Boolean;
 var
 var
@@ -1741,10 +1738,7 @@ begin
     (r1.symbol=r2.symbol) and
     (r1.symbol=r2.symbol) and
     (r1.base = r2.base)
     (r1.base = r2.base)
 end;
 end;
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif overflowon}
+{$pop}
 
 
 function isSimpleRef(const ref: treference): boolean;
 function isSimpleRef(const ref: treference): boolean;
 { returns true if ref is reference to a local or global variable, to a  }
 { returns true if ref is reference to a local or global variable, to a  }
@@ -2791,10 +2785,8 @@ begin
     pass_generate_code := false;
     pass_generate_code := false;
 end;
 end;
 
 
-{$ifopt r+}
-{$define rangewason}
+{$push}
 {$r-}
 {$r-}
-{$endif}
 function tdfaobj.getlabelwithsym(sym: tasmlabel): tai;
 function tdfaobj.getlabelwithsym(sym: tasmlabel): tai;
 begin
 begin
   if (sym.labelnr >= lolab) and
   if (sym.labelnr >= lolab) and
@@ -2803,10 +2795,7 @@ begin
   else
   else
     getlabelwithsym := nil;
     getlabelwithsym := nil;
 end;
 end;
-{$ifdef rangewason}
-{$r+}
-{$undef rangewason}
-{$endif}
+{$pop}
 
 
 
 
 procedure tdfaobj.clear;
 procedure tdfaobj.clear;

+ 30 - 30
compiler/i386/i386tab.inc

@@ -381,15 +381,22 @@
   (
   (
     opcode  : A_CALL;
     opcode  : A_CALL;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_immediate,ot_none,ot_none,ot_none);
-    code    : #208#1#232#52;
+    optypes : (ot_rm_gpr or ot_bits32,ot_none,ot_none,ot_none);
+    code    : #213#1#255#130;
+    flags   : if_386 or if_nox86_64
+  ),
+  (
+    opcode  : A_CALL;
+    ops     : 1;
+    optypes : (ot_rm_gpr or ot_bits16,ot_none,ot_none,ot_none);
+    code    : #212#1#255#130;
     flags   : if_8086
     flags   : if_8086
   ),
   ),
   (
   (
     opcode  : A_CALL;
     opcode  : A_CALL;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_rm_gpr or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
-    code    : #208#1#255#130;
+    optypes : (ot_immediate,ot_none,ot_none,ot_none);
+    code    : #208#1#232#52;
     flags   : if_8086
     flags   : if_8086
   ),
   ),
   (
   (
@@ -2537,8 +2544,15 @@
   (
   (
     opcode  : A_JMP;
     opcode  : A_JMP;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_rm_gpr or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
-    code    : #208#1#255#132;
+    optypes : (ot_rm_gpr or ot_bits32,ot_none,ot_none,ot_none);
+    code    : #213#1#255#132;
+    flags   : if_386 or if_nox86_64
+  ),
+  (
+    opcode  : A_JMP;
+    ops     : 1;
+    optypes : (ot_rm_gpr or ot_bits16,ot_none,ot_none,ot_none);
+    code    : #212#1#255#132;
     flags   : if_8086
     flags   : if_8086
   ),
   ),
   (
   (
@@ -2614,22 +2628,15 @@
   (
   (
     opcode  : A_LCALL;
     opcode  : A_LCALL;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_rm_gpr or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
-    code    : #208#1#255#130;
-    flags   : if_8086
-  ),
-  (
-    opcode  : A_LCALL;
-    ops     : 1;
-    optypes : (ot_memory or ot_near,ot_none,ot_none,ot_none);
-    code    : #208#1#255#130;
-    flags   : if_8086
+    optypes : (ot_memory or ot_bits32,ot_none,ot_none,ot_none);
+    code    : #213#1#255#131;
+    flags   : if_386 or if_nox86_64
   ),
   ),
   (
   (
     opcode  : A_LCALL;
     opcode  : A_LCALL;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_memory or ot_far,ot_none,ot_none,ot_none);
-    code    : #208#1#255#131;
+    optypes : (ot_memory or ot_bits16,ot_none,ot_none,ot_none);
+    code    : #212#1#255#131;
     flags   : if_8086
     flags   : if_8086
   ),
   ),
   (
   (
@@ -2698,22 +2705,15 @@
   (
   (
     opcode  : A_LJMP;
     opcode  : A_LJMP;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_rm_gpr or ot_bits16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
-    code    : #208#1#255#133;
-    flags   : if_8086
-  ),
-  (
-    opcode  : A_LJMP;
-    ops     : 1;
-    optypes : (ot_memory or ot_far,ot_none,ot_none,ot_none);
-    code    : #208#1#255#133;
-    flags   : if_8086
+    optypes : (ot_memory or ot_bits32,ot_none,ot_none,ot_none);
+    code    : #213#1#255#133;
+    flags   : if_386 or if_nox86_64
   ),
   ),
   (
   (
     opcode  : A_LJMP;
     opcode  : A_LJMP;
     ops     : 1;
     ops     : 1;
-    optypes : (ot_memory or ot_near,ot_none,ot_none,ot_none);
-    code    : #208#1#255#132;
+    optypes : (ot_memory or ot_bits16,ot_none,ot_none,ot_none);
+    code    : #212#1#255#133;
     flags   : if_8086
     flags   : if_8086
   ),
   ),
   (
   (

+ 2 - 62
compiler/i386/n386mem.pas

@@ -28,7 +28,7 @@ interface
     uses
     uses
       globtype,
       globtype,
       cgbase,cpuinfo,cpubase,
       cgbase,cpuinfo,cpubase,
-      node,nmem,ncgmem;
+      node,nmem,ncgmem,nx86mem;
 
 
     type
     type
        ti386addrnode = class(tcgaddrnode)
        ti386addrnode = class(tcgaddrnode)
@@ -39,8 +39,7 @@ interface
           procedure pass_generate_code;override;
           procedure pass_generate_code;override;
        end;
        end;
 
 
-       ti386vecnode = class(tcgvecnode)
-          procedure update_reference_reg_mul(maybe_const_reg:tregister;l:aint);override;
+       ti386vecnode = class(tx86vecnode)
           procedure pass_generate_code;override;
           procedure pass_generate_code;override;
        end;
        end;
 
 
@@ -84,65 +83,6 @@ implementation
                              TI386VECNODE
                              TI386VECNODE
 *****************************************************************************}
 *****************************************************************************}
 
 
-     { this routine must, like any other routine, not change the contents }
-     { of base/index registers of references, as these may be regvars.    }
-     { The register allocator can coalesce one LOC_REGISTER being moved   }
-     { into another (as their live ranges won't overlap), but not a       }
-     { LOC_CREGISTER moved into a LOC_(C)REGISTER most of the time (as    }
-     { the live range of the LOC_CREGISTER will most likely overlap the   }
-     { the live range of the target LOC_(C)REGISTER)                      }
-     { The passed register may be a LOC_CREGISTER as well.                }
-     procedure ti386vecnode.update_reference_reg_mul(maybe_const_reg:tregister;l:aint);
-       var
-         l2 : integer;
-         hreg : tregister;
-       begin
-         { Optimized for x86 to use the index register and scalefactor }
-         if location.reference.index=NR_NO then
-          begin
-            { no preparations needed }
-          end
-         else if location.reference.base=NR_NO then
-          begin
-            if (location.reference.scalefactor > 1) then
-              hreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
-            case location.reference.scalefactor of
-             0,1 : hreg:=location.reference.index;
-             2 : cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,1,location.reference.index,hreg);
-             4 : cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,2,location.reference.index,hreg);
-             8 : cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,3,location.reference.index,hreg);
-             else
-               internalerror(2008091401);
-            end;
-            location.reference.base:=hreg;
-          end
-         else
-          begin
-            hreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
-            cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,location.reference,hreg);
-            reference_reset_base(location.reference,hreg,0,location.reference.alignment);
-          end;
-         { insert the new index register and scalefactor or
-           do the multiplication manual }
-         case l of
-          1,2,4,8 :
-            begin
-              location.reference.scalefactor:=l;
-              hreg:=maybe_const_reg;
-            end;
-         else
-           begin
-              hreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
-              if ispowerof2(l,l2) then
-                cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,l2,maybe_const_reg,hreg)
-              else
-                cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_ADDR,l,maybe_const_reg,hreg);
-           end;
-         end;
-         location.reference.index:=hreg;
-       end;
-
-
     procedure ti386vecnode.pass_generate_code;
     procedure ti386vecnode.pass_generate_code;
       begin
       begin
         inherited pass_generate_code;
         inherited pass_generate_code;

+ 0 - 88
compiler/i386/n386set.pas

@@ -32,7 +32,6 @@ interface
     type
     type
       ti386casenode = class(tx86casenode)
       ti386casenode = class(tx86casenode)
          procedure optimizevalues(var max_linear_list:aint;var max_dist:aword);override;
          procedure optimizevalues(var max_linear_list:aint;var max_dist:aword);override;
-         procedure genlinearlist(hp : pcaselabel);override;
       end;
       end;
 
 
 
 
@@ -68,93 +67,6 @@ implementation
       end;
       end;
 
 
 
 
-    procedure ti386casenode.genlinearlist(hp : pcaselabel);
-      var
-        first : boolean;
-        lastrange : boolean;
-        last : TConstExprInt;
-        cond_lt,cond_le : tresflags;
-
-        procedure genitem(t : pcaselabel);
-          begin
-             if assigned(t^.less) then
-               genitem(t^.less);
-             { need we to test the first value }
-             if first and (t^._low>get_min_value(left.resultdef)) then
-               begin
-                 cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(t^._low.svalue),hregister,elselabel);
-               end;
-             if t^._low=t^._high then
-               begin
-                  if t^._low-last=0 then
-                    cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ,0,hregister,blocklabel(t^.blockid))
-                  else
-                    begin
-                      cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low.svalue-last.svalue), hregister);
-                      cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,blocklabel(t^.blockid));
-                    end;
-                  last:=t^._low;
-                  lastrange:=false;
-               end
-             else
-               begin
-                  { it begins with the smallest label, if the value }
-                  { is even smaller then jump immediately to the    }
-                  { ELSE-label                                }
-                  if first then
-                    begin
-                       { have we to ajust the first value ? }
-                       if (t^._low>get_min_value(left.resultdef)) or (get_min_value(left.resultdef)<>0) then
-                         cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low.svalue), hregister);
-                    end
-                  else
-                    begin
-                      { if there is no unused label between the last and the }
-                      { present label then the lower limit can be checked    }
-                      { immediately. else check the range in between:       }
-
-                      cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low.svalue-last.svalue), hregister);
-                      { no jump necessary here if the new range starts at }
-                      { at the value following the previous one           }
-                      if ((t^._low-last) <> 1) or
-                         (not lastrange) then
-                        cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_lt,elselabel);
-                    end;
-                  {we need to use A_SUB, because A_DEC does not set the correct flags, therefor
-                   using a_op_const_reg(OP_SUB) is not possible }
-                  emit_const_reg(A_SUB,TCGSize2OpSize[opsize],aint(t^._high.svalue-t^._low.svalue),hregister);
-                  cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_le,blocklabel(t^.blockid));
-                  last:=t^._high;
-                  lastrange:=true;
-               end;
-             first:=false;
-             if assigned(t^.greater) then
-               genitem(t^.greater);
-          end;
-
-        begin
-           if with_sign then
-             begin
-                cond_lt:=F_L;
-                cond_le:=F_LE;
-             end
-           else
-              begin
-                cond_lt:=F_B;
-                cond_le:=F_BE;
-             end;
-           { do we need to generate cmps? }
-           if (with_sign and (min_label<0)) then
-             genlinearcmplist(hp)
-           else
-             begin
-                last:=0;
-                lastrange:=false;
-                first:=true;
-                genitem(hp);
-                cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
-             end;
-        end;
 
 
 begin
 begin
    ccasenode:=ti386casenode;
    ccasenode:=ti386casenode;

+ 6 - 6
compiler/impdef.pas

@@ -161,9 +161,9 @@ procedure CreateTempDir(const s:string);
    end
    end
  else
  else
   begin
   begin
-    {$I-}
+    {$push} {$I-}
      mkdir(s);
      mkdir(s);
-    {$I+}
+    {$pop}
     if ioresult<>0 then;
     if ioresult<>0 then;
   end;
   end;
  end;
  end;
@@ -189,9 +189,9 @@ procedure call_ar;
   ExecuteProcess(ar_name,'rs '+impname+' '+path+dirsep+'*.swo');
   ExecuteProcess(ar_name,'rs '+impname+' '+path+dirsep+'*.swo');
   cleardir(path,'*.sw');
   cleardir(path,'*.sw');
   cleardir(path,'*.swo');
   cleardir(path,'*.swo');
-  {$i-}
+  {$push} {$I-}
   RmDir(path);
   RmDir(path);
-  {$i+}
+  {$pop}
   if ioresult<>0 then;
   if ioresult<>0 then;
  end;
  end;
 procedure makeasm(index:cardinal;name:pchar;isData:longbool);
 procedure makeasm(index:cardinal;name:pchar;isData:longbool);
@@ -446,11 +446,11 @@ begin
   impname:=libname;
   impname:=libname;
   lname:=binname;
   lname:=binname;
   OldFileMode:=filemode;
   OldFileMode:=filemode;
-  {$I-}
+  {$push} {$I-}
    filemode:=0;
    filemode:=0;
    reset(f,1);
    reset(f,1);
    filemode:=OldFileMode;
    filemode:=OldFileMode;
-  {$I+}
+  {$pop}
   if IOResult<>0 then
   if IOResult<>0 then
    begin
    begin
      makedef:=false;
      makedef:=false;

+ 34 - 2
compiler/link.pas

@@ -79,6 +79,7 @@ interface
          Constructor Create;override;
          Constructor Create;override;
          Destructor Destroy;override;
          Destructor Destroy;override;
          Function  FindUtil(const s:TCmdStr):TCmdStr;
          Function  FindUtil(const s:TCmdStr):TCmdStr;
+         Function  CatFileContent(para:TCmdStr):TCmdStr;
          Function  DoExec(const command:TCmdStr; para:TCmdStr;showinfo,useshell:boolean):boolean;
          Function  DoExec(const command:TCmdStr; para:TCmdStr;showinfo,useshell:boolean):boolean;
          procedure SetDefaultInfo;virtual;
          procedure SetDefaultInfo;virtual;
          Function  MakeStaticLibrary:boolean;override;
          Function  MakeStaticLibrary:boolean;override;
@@ -671,6 +672,39 @@ Implementation
       end;
       end;
 
 
 
 
+    Function TExternalLinker.CatFileContent(para : TCmdStr) : TCmdStr;
+      var
+        filecontent : TCmdStr;
+        f : text;
+        st : string;
+      begin
+        if not (tf_no_backquote_support in source_info.flags) then
+           begin
+             CatFileContent:='`cat '+MaybeQuoted(para)+'`';
+             Exit;
+           end;
+        assign(f,para);
+        filecontent:='';
+        {$push}{$I-}
+        reset(f);
+        {$pop}
+        if IOResult<>0 then
+          begin
+            Message1(exec_n_backquote_cat_file_not_found,para);
+          end
+        else
+          begin
+            while not eof(f) do
+              begin
+                readln(f,st);
+                if st<>'' then
+                  filecontent:=filecontent+' '+st;
+              end;
+            close(f);
+          end;
+        CatFileContent:=filecontent;
+      end;
+
     Function TExternalLinker.DoExec(const command:TCmdStr; para:TCmdStr;showinfo,useshell:boolean):boolean;
     Function TExternalLinker.DoExec(const command:TCmdStr; para:TCmdStr;showinfo,useshell:boolean):boolean;
       var
       var
         exitcode: longint;
         exitcode: longint;
@@ -953,7 +987,6 @@ Implementation
 
 
     procedure TInternalLinker.ParseScript_PostCheck;
     procedure TInternalLinker.ParseScript_PostCheck;
       var
       var
-        s : String;
         hp : TCmdStrListItem;
         hp : TCmdStrListItem;
         i : longint;
         i : longint;
       begin
       begin
@@ -964,7 +997,6 @@ Implementation
             inc(i);
             inc(i);
             if not IsHandled^[i] then
             if not IsHandled^[i] then
               begin
               begin
-                s:=hp.str;
                 Comment(V_Warning,'"'+hp.str+
                 Comment(V_Warning,'"'+hp.str+
                   '" internal linker script not handled');
                   '" internal linker script not handled');
               end;
               end;

+ 24 - 7
compiler/m68k/cpupara.pas

@@ -45,14 +45,15 @@ unit cpupara;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
           function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
           function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
           function get_funcretloc(p : tabstractprocdef; side: tcallercallee; def: tdef): tcgpara;override;
           function get_funcretloc(p : tabstractprocdef; side: tcallercallee; def: tdef): tcgpara;override;
-          procedure createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;can_use_final_stack_loc : boolean;var cgpara:TCGPara);
+          procedure createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;can_use_final_stack_loc : boolean;var cgpara:TCGPara);override;
           procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
           procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
+          function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override;
+          function parseparaloc(p : tparavarsym;const s : string) : boolean;override;
+          function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;override;
          private
          private
           procedure init_values(var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword);
           procedure init_values(var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword);
           function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
           function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
                                                var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword):longint;
                                                var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword):longint;
-          function parseparaloc(p : tparavarsym;const s : string) : boolean;override;
-          function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;override;
        end;
        end;
 
 
   implementation
   implementation
@@ -89,7 +90,7 @@ unit cpupara;
 
 
       begin
       begin
          result:=LOC_REFERENCE;
          result:=LOC_REFERENCE;
-         { Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
+         (* Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
            if push_addr_param for the def is true
            if push_addr_param for the def is true
          case p.typ of
          case p.typ of
             orddef:
             orddef:
@@ -141,7 +142,7 @@ unit cpupara;
             else
             else
               internalerror(2002071001);
               internalerror(2002071001);
          end;
          end;
-         }
+         *)
       end;
       end;
 
 
 
 
@@ -379,7 +380,7 @@ unit cpupara;
             while (paralen > 0) do
             while (paralen > 0) do
               begin
               begin
                 paraloc:=hp.paraloc[side].add_location;
                 paraloc:=hp.paraloc[side].add_location;
-                {
+                (*
                   by default, the m68k doesn't know any register parameters  (FK)
                   by default, the m68k doesn't know any register parameters  (FK)
                 if (loc = LOC_REGISTER) and
                 if (loc = LOC_REGISTER) and
                    (nextintreg <= RS_D2) then
                    (nextintreg <= RS_D2) then
@@ -408,7 +409,7 @@ unit cpupara;
                     dec(paralen,tcgsize2size[paraloc^.size]);
                     dec(paralen,tcgsize2size[paraloc^.size]);
                   end
                   end
                 else { LOC_REFERENCE }
                 else { LOC_REFERENCE }
-}
+                *)
                   begin
                   begin
 {$ifdef DEBUG_CHARLIE}
 {$ifdef DEBUG_CHARLIE}
 		    writeln('loc reference');
 		    writeln('loc reference');
@@ -577,6 +578,22 @@ unit cpupara;
         inherited createtempparaloc(list,calloption,parasym,can_use_final_stack_loc,cgpara);
         inherited createtempparaloc(list,calloption,parasym,can_use_final_stack_loc,cgpara);
       end;
       end;
 
 
+    function tm68kparamanager.create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;
+      var
+        cur_stack_offset: aword;
+        curintreg, curfloatreg: tsuperregister;
+      begin
+        init_values(curintreg,curfloatreg,cur_stack_offset);
+
+        result:=create_paraloc_info_intern(p,callerside,p.paras,curintreg,curfloatreg,cur_stack_offset);
+        if (p.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
+          { just continue loading the parameters in the registers }
+          result:=create_paraloc_info_intern(p,callerside,varargspara,curintreg,curfloatreg,cur_stack_offset)
+        else
+          internalerror(200410231);
+      end;
+
+
 begin
 begin
   paramanager:=tm68kparamanager.create;
   paramanager:=tm68kparamanager.create;
 end.
 end.

+ 4 - 4
compiler/machoutils.pas

@@ -1182,7 +1182,7 @@ const
     begin
     begin
       if not Assigned(fCnv) then
       if not Assigned(fCnv) then
         IntReadStruct;
         IntReadStruct;
-      Result:=(index>=0) and (index<fHdr.ncmds);
+      Result:={(index>=0) and }(index<fHdr.ncmds);
       if not Result then
       if not Result then
         Exit;
         Exit;
       Result:=true;
       Result:=true;
@@ -1198,7 +1198,7 @@ const
       if not Assigned(fCnv) then
       if not Assigned(fCnv) then
         IntReadStruct;
         IntReadStruct;
 
 
-      Result:=(cmdindex>=0) and
+      Result:={(cmdindex>=0) and }
               (cmdindex<fHdr.ncmds) and
               (cmdindex<fHdr.ncmds) and
               (cmds[cmdindex].cmd in [LC_SEGMENT, LC_SEGMENT_64]);
               (cmds[cmdindex].cmd in [LC_SEGMENT, LC_SEGMENT_64]);
 
 
@@ -1226,7 +1226,7 @@ const
       if not Assigned(fCnv) then
       if not Assigned(fCnv) then
         IntReadStruct;
         IntReadStruct;
 
 
-      if (index<0) or
+      if {(index<0) or}
          (index>=longword(length(cmdofs))) then
          (index>=longword(length(cmdofs))) then
         Result:=0
         Result:=0
       else
       else
@@ -1245,7 +1245,7 @@ const
     begin
     begin
       if not Assigned(fCnv) then
       if not Assigned(fCnv) then
         IntReadStruct;
         IntReadStruct;
-      Result:=(secindex>=0) and (segindex>=0) and (segindex<fHdr.ncmds) and (cmds[segindex].cmd in [LC_SEGMENT, LC_SEGMENT_64]);
+      Result:={(secindex>=0) and (segindex>=0) and }(segindex<fHdr.ncmds) and (cmds[segindex].cmd in [LC_SEGMENT, LC_SEGMENT_64]);
       if not Result then
       if not Result then
         Exit;
         Exit;
 
 

+ 13 - 0
compiler/mips/cgcpu.pas

@@ -86,6 +86,9 @@ type
     procedure g_concatcopy_unaligned(list: tasmlist; const Source, dest: treference; len: tcgint); override;
     procedure g_concatcopy_unaligned(list: tasmlist; const Source, dest: treference; len: tcgint); override;
     procedure g_concatcopy_move(list: tasmlist; const Source, dest: treference; len: tcgint);
     procedure g_concatcopy_move(list: tasmlist; const Source, dest: treference; len: tcgint);
     procedure g_intf_wrapper(list: tasmlist; procdef: tprocdef; const labelname: string; ioffset: longint); override;
     procedure g_intf_wrapper(list: tasmlist; procdef: tprocdef; const labelname: string; ioffset: longint); override;
+    { Transform unsupported methods into Internal errors }
+    procedure a_bit_scan_reg_reg(list: TAsmList; reverse: boolean; size: TCGSize; src, dst: TRegister); override;
+    procedure g_stackpointer_alloc(list : TAsmList;localsize : longint);override;
   end;
   end;
 
 
   TCg64MPSel = class(tcg64f32)
   TCg64MPSel = class(tcg64f32)
@@ -1693,6 +1696,16 @@ begin
   List.concat(Tai_symbol_end.Createname(labelname));
   List.concat(Tai_symbol_end.Createname(labelname));
 end;
 end;
 
 
+procedure TCgMPSel.g_stackpointer_alloc(list : TAsmList;localsize : longint);
+  begin
+    Comment(V_Error,'TCgMPSel.g_stackpointer_alloc method not implemented');
+  end;
+
+procedure TCgMPSel.a_bit_scan_reg_reg(list: TAsmList; reverse: boolean; size: TCGSize; src, dst: TRegister);
+  begin
+    Comment(V_Error,'TCgMPSel.a_bit_scan_reg_reg method not implemented');
+  end;
+
 {****************************************************************************
 {****************************************************************************
                                TCG64_MIPSel
                                TCG64_MIPSel
 ****************************************************************************}
 ****************************************************************************}

+ 0 - 75
compiler/mips/rmipsmot.inc

@@ -1,75 +0,0 @@
-{ don't edit, this file is generated from mipsreg.dat }
-'INVALID',
-'r0',
-'r1',
-'r2',
-'r3',
-'r4',
-'r5',
-'r6',
-'r7',
-'r8',
-'r9',
-'r10',
-'r11',
-'r12',
-'r13',
-'r14',
-'r15',
-'r16',
-'r17',
-'r18',
-'r19',
-'r20',
-'r21',
-'r22',
-'r23',
-'r24',
-'r25',
-'r26',
-'r27',
-'r28',
-'r29',
-'r30',
-'r31',
-'F0',
-'F1',
-'F2',
-'F3',
-'F4',
-'F5',
-'F6',
-'F7',
-'F8',
-'F9',
-'F10',
-'F11',
-'F12',
-'F13',
-'F14',
-'F15',
-'F16',
-'F17',
-'F18',
-'F19',
-'F20',
-'F21',
-'F22',
-'F23',
-'F24',
-'F25',
-'F26',
-'F27',
-'F28',
-'F29',
-'F30',
-'F31',
-'PC',
-'HI',
-'LO',
-'CR',
-'FCR0',
-'FCR25',
-'FCR26',
-'FCR28',
-'FCSR'

+ 0 - 75
compiler/mips/rmipsmri.inc

@@ -1,75 +0,0 @@
-{ don't edit, this file is generated from mipsreg.dat }
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0

+ 56 - 8
compiler/msg/errore.msg

@@ -41,6 +41,9 @@
 #   x_   executable informations
 #   x_   executable informations
 #   o_   normal (e.g., "press enter to continue")
 #   o_   normal (e.g., "press enter to continue")
 #
 #
+# <type> can contain a minus sign at the beginning to mark that
+# the message is off by default. Look at type_w_explicit_string_cast
+# for example.
 
 
 #
 #
 # General
 # General
@@ -375,7 +378,7 @@ scanner_e_illegal_alignment_directive=02088_E_Illegal alignment directive
 #
 #
 # Parser
 # Parser
 #
 #
-# 03310 is the last used one
+# 03314 is the last used one
 #
 #
 % \section{Parser messages}
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
 % This section lists all parser messages. The parser takes care of the
@@ -1400,10 +1403,13 @@ parser_e_mapping_no_implements=03312_E_Interface "$1" can't be delegated by "$2"
 % has to implement the interface directly. Delegation is not possible.
 % has to implement the interface directly. Delegation is not possible.
 parser_e_implements_no_mapping=03313_E_Interface "$1" can't have method resolutions, "$2" already delegates it
 parser_e_implements_no_mapping=03313_E_Interface "$1" can't have method resolutions, "$2" already delegates it
 % Method resoulution is only possible for interfaces that are implemented directly, not by delegation.
 % Method resoulution is only possible for interfaces that are implemented directly, not by delegation.
+parser_e_invalid_codepage=03314_E_Invalid codepage
+% When declaring a string with a given codepage, the range of valid codepages values is limited
+% to 0 to 65535.
 % \end{description}
 % \end{description}
 # Type Checking
 # Type Checking
 #
 #
-# 04100 is the last used one
+# 04108 is the last used one
 #
 #
 % \section{Type checking errors}
 % \section{Type checking errors}
 % This section lists all errors that can occur when type checking is
 % This section lists all errors that can occur when type checking is
@@ -1767,6 +1773,24 @@ type_e_procedures_return_no_value=04103_E_Invalid assignment, procedures return
 % This error occurs when one tries to assign the result of a procedure or destructor call.
 % This error occurs when one tries to assign the result of a procedure or destructor call.
 % A procedure or destructor returns no value so this is not
 % A procedure or destructor returns no value so this is not
 % possible.
 % possible.
+type_w_implicit_string_cast=04104_W_Implicit string type conversion from "$1" to "$2"
+% An implicit type conversion from an ansi string type to an unicode string type is
+% encountered. To avoid this warning perform an explicit type conversion.
+type_w_implicit_string_cast_loss=04105_W_Implicit string type conversion with potential data loss from "$1" to "$2"
+% An implicit type conversion from an unicode string type to an ansi string type is
+% encountered. This conversion can lose data since not all unicode characters may be represented in the codepage of
+% destination string type.
+type_w_explicit_string_cast=04106_-W_Explicit string typecast from "$1" to "$2"
+% An explicit typecast from an ansi string type to an unicode string type is
+% encountered. This warning is off by default. You can turn it on to see all suspicious string conversions.
+type_w_explicit_string_cast_loss=04107_-W_Explicit string typecast with potential data loss from "$1" to "$2"
+% An explicit typecast from an unicode string type to an ansi string type is
+% encountered. This conversion can lose data since not all unicode characters may be represented in the codepage of
+% destination string type. This warning is off by default. You can turn it on to see all the places with lossy string
+% conversions.
+type_w_unicode_data_loss=04108_W_Unicode constant cast with potential data loss
+% Conversion from a WideChar to AnsiChar can lose data since now all unicode characters may be represented in the current
+% system codepage
 % \end{description}
 % \end{description}
 #
 #
 # Symtable
 # Symtable
@@ -2167,6 +2191,8 @@ cg_e_goto_across_procedures_with_exceptions_not_allowed=06053_E_Leaving procedur
 % Non-local gotos might not be used to leave procedures using exceptions either implicitly or explicitly. Procedures
 % Non-local gotos might not be used to leave procedures using exceptions either implicitly or explicitly. Procedures
 % which use automated types like ansistrings or class constructurs are affected by this too.
 % which use automated types like ansistrings or class constructurs are affected by this too.
 % \end{description}
 % \end{description}
+cg_e_mod_only_defined_for_pos_quotient=06054_E_In ISO mode, the mod operator is defined only for positive quotient
+% In ISO pascal, only positive values are allowed for the quotient: \var{n mod m} is only valid if \var{m>0}.
 # EndOfTeX
 # EndOfTeX
 
 
 #
 #
@@ -2431,6 +2457,17 @@ asmr_w_useless_got_for_local=07110_W_@GOTPCREL is useless and potentially danger
 asmr_w_general_segment_with_constant=07111_W_Constant with general purpose segment register
 asmr_w_general_segment_with_constant=07111_W_Constant with general purpose segment register
 % General purpose register should not have constant offsets
 % General purpose register should not have constant offsets
 % as OS memory allocation might not be compatible with that.
 % as OS memory allocation might not be compatible with that.
+asmr_e_bad_seh_directive_offset=07112_E_Invalid offset value for $1
+% Win64 SEH directives have certain restrictions on possible offset values, e.g. they should
+% be positive and have 3 or 4 low bits clear.
+asmr_e_bad_seh_directive_register=07113_E_Invalid register for $1
+% Win64 SEH directives accept only 64-bit integer registers or XMM registers.
+asmr_e_seh_in_pure_asm_only=07114_E_SEH directives are allowed only in pure assembler procedures
+% Win64 SEH directives are allowed only in pure assembler procedures, not in assembler
+% blocks of regular procedures.
+asmr_e_unsupported_directive=07115_E_Directive "$1" is not supported for the current target
+
+
 #
 #
 # Assembler/binary writers
 # Assembler/binary writers
 #
 #
@@ -2466,11 +2503,20 @@ asmw_e_bad_reg_with_rex=08022_E_Asm: AH,BH,CH or DH cannot be used in an instruc
 % 8086 high byte registers (AH,BH,CH or DH) together with REX prefix in a single instruction.
 % 8086 high byte registers (AH,BH,CH or DH) together with REX prefix in a single instruction.
 % The REX prefix is required whenever the instruction operand size is 64 bits, or
 % The REX prefix is required whenever the instruction operand size is 64 bits, or
 % when it uses one of extended x86_64 registers (R8-R15 or XMM8-XMM15).
 % when it uses one of extended x86_64 registers (R8-R15 or XMM8-XMM15).
+asmw_e_missing_endprologue=08023_E_Missing .seh_endprologue directive
+% x86_64-win64 only: Normally, SEH directives are handled internally by compiler.
+% However, in pure assembler procedures .seh_endprologue directive is required
+% if other SEH directives are present.
+asmw_e_prologue_too_large=08024_E_Function prologue exceeds 255 bytes
+% x86_64-win64: .seh_prologue directive must be placed within 255 bytes from function start.
+asmw_e_handlerdata_no_handler=08025_E_.seh_handlerdata directive without preceding .seh_handler
+% x86_64-win64: If .seh_handlerdata directive is used, then a .seh_handler directive must be
+% present earlier in the same function.
 
 
 #
 #
 # Executing linker/assembler
 # Executing linker/assembler
 #
 #
-# 09032 is the last used one
+# 09033 is the last used one
 #
 #
 # BeginOfTeX
 # BeginOfTeX
 %
 %
@@ -2560,6 +2606,8 @@ exec_e_cant_open_resource_file=09031_E_Can't open resource file "$1"
 % An error occurred resource file cannot be opened.
 % An error occurred resource file cannot be opened.
 exec_e_cant_write_resource_file=09032_E_Can't write resource file "$1"
 exec_e_cant_write_resource_file=09032_E_Can't write resource file "$1"
 % An error occurred resource file cannot be written.
 % An error occurred resource file cannot be written.
+exec_n_backquote_cat_file_not_found=09033_N_File "$1" not found for backquoted cat command
+% The compiler did not find the file that should be expanded into linker parameters
 %\end{description}
 %\end{description}
 # EndOfTeX
 # EndOfTeX
 
 
@@ -2915,10 +2963,10 @@ option_read_config_file=11034_D_Reading config file "$1"
 option_found_file=11035_D_found source file name "$1"
 option_found_file=11035_D_found source file name "$1"
 % Additional information about options.
 % Additional information about options.
 % Displayed when you have the debug option turned on.
 % Displayed when you have the debug option turned on.
-option_code_page_not_available=11039_E_Unknown code page
-% An unknown code page for the source files was requested.
-% The compiler is compiled with support for several code pages built-in.
-% The requested code page is not in that list. You will need to recompile
+option_code_page_not_available=11039_E_Unknown codepage
+% An unknown codepage for the source files was requested.
+% The compiler is compiled with support for several codepages built-in.
+% The requested codepage is not in that list. You will need to recompile
 % the compiler with support for the codepage you need.
 % the compiler with support for the codepage you need.
 option_config_is_dir=11040_F_Config file $1 is a directory
 option_config_is_dir=11040_F_Config file $1 is a directory
 % Directories cannot be used as configuration files.
 % Directories cannot be used as configuration files.
@@ -2945,7 +2993,7 @@ option_ignored_target=11047_W_Option "$1" is ignored for the current target plat
 option_debug_external_unsupported=11048_W_Disabling external debug information because it is unsupported for the selected target/debug format combination.
 option_debug_external_unsupported=11048_W_Disabling external debug information because it is unsupported for the selected target/debug format combination.
 % Not all debug formats can be stored in an external file on all platforms. In particular, on
 % Not all debug formats can be stored in an external file on all platforms. In particular, on
 % Mac OS X only DWARF debug information can be stored externally.
 % Mac OS X only DWARF debug information can be stored externally.
-option_dwarf_smartlink_creation=11049_N_DWARF debug information cannot be used with smart linking with external assembler, disabling static library creation.  
+option_dwarf_smartlink_creation=11049_N_DWARF debug information cannot be used with smart linking with external assembler, disabling static library creation.
 % Smart linking is currently incompatble with DWARF debug information on most
 % Smart linking is currently incompatble with DWARF debug information on most
 % platforms, so smart linking is disabled in such cases.
 % platforms, so smart linking is disabled in such cases.
 %\end{description}
 %\end{description}

+ 17 - 2
compiler/msgidx.inc

@@ -405,6 +405,7 @@ const
   parser_e_duplicate_implements_clause=03311;
   parser_e_duplicate_implements_clause=03311;
   parser_e_mapping_no_implements=03312;
   parser_e_mapping_no_implements=03312;
   parser_e_implements_no_mapping=03313;
   parser_e_implements_no_mapping=03313;
+  parser_e_invalid_codepage=03314;
   type_e_mismatch=04000;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
   type_e_not_equal_types=04002;
@@ -499,6 +500,11 @@ const
   type_e_class_helper_must_extend_subclass=04101;
   type_e_class_helper_must_extend_subclass=04101;
   type_e_record_helper_must_extend_same_record=04102;
   type_e_record_helper_must_extend_same_record=04102;
   type_e_procedures_return_no_value=04103;
   type_e_procedures_return_no_value=04103;
+  type_w_implicit_string_cast=04104;
+  type_w_implicit_string_cast_loss=04105;
+  type_w_explicit_string_cast=04106;
+  type_w_explicit_string_cast_loss=04107;
+  type_w_unicode_data_loss=04108;
   sym_e_id_not_found=05000;
   sym_e_id_not_found=05000;
   sym_f_internal_error_in_symtablestack=05001;
   sym_f_internal_error_in_symtablestack=05001;
   sym_e_duplicate_id=05002;
   sym_e_duplicate_id=05002;
@@ -601,6 +607,7 @@ const
   cg_e_interprocedural_goto_only_to_outer_scope_allowed=06051;
   cg_e_interprocedural_goto_only_to_outer_scope_allowed=06051;
   cg_e_labels_cannot_defined_outside_declaration_scope=06052;
   cg_e_labels_cannot_defined_outside_declaration_scope=06052;
   cg_e_goto_across_procedures_with_exceptions_not_allowed=06053;
   cg_e_goto_across_procedures_with_exceptions_not_allowed=06053;
+  cg_e_mod_only_defined_for_pos_quotient=06054;
   asmr_d_start_reading=07000;
   asmr_d_start_reading=07000;
   asmr_d_finish_reading=07001;
   asmr_d_finish_reading=07001;
   asmr_e_none_label_contain_at=07002;
   asmr_e_none_label_contain_at=07002;
@@ -708,6 +715,10 @@ const
   asmr_e_empty_regset=07109;
   asmr_e_empty_regset=07109;
   asmr_w_useless_got_for_local=07110;
   asmr_w_useless_got_for_local=07110;
   asmr_w_general_segment_with_constant=07111;
   asmr_w_general_segment_with_constant=07111;
+  asmr_e_bad_seh_directive_offset=07112;
+  asmr_e_bad_seh_directive_register=07113;
+  asmr_e_seh_in_pure_asm_only=07114;
+  asmr_e_unsupported_directive=07115;
   asmw_f_too_many_asm_files=08000;
   asmw_f_too_many_asm_files=08000;
   asmw_f_assembler_output_not_supported=08001;
   asmw_f_assembler_output_not_supported=08001;
   asmw_f_comp_not_supported=08002;
   asmw_f_comp_not_supported=08002;
@@ -731,6 +742,9 @@ const
   asmw_e_16bit_32bit_not_supported=08020;
   asmw_e_16bit_32bit_not_supported=08020;
   asmw_e_64bit_not_supported=08021;
   asmw_e_64bit_not_supported=08021;
   asmw_e_bad_reg_with_rex=08022;
   asmw_e_bad_reg_with_rex=08022;
+  asmw_e_missing_endprologue=08023;
+  asmw_e_prologue_too_large=08024;
+  asmw_e_handlerdata_no_handler=08025;
   exec_w_source_os_redefined=09000;
   exec_w_source_os_redefined=09000;
   exec_i_assembling_pipe=09001;
   exec_i_assembling_pipe=09001;
   exec_d_cant_create_asmfile=09002;
   exec_d_cant_create_asmfile=09002;
@@ -764,6 +778,7 @@ const
   exec_e_cant_call_resource_compiler=09030;
   exec_e_cant_call_resource_compiler=09030;
   exec_e_cant_open_resource_file=09031;
   exec_e_cant_open_resource_file=09031;
   exec_e_cant_write_resource_file=09032;
   exec_e_cant_write_resource_file=09032;
+  exec_n_backquote_cat_file_not_found=09033;
   execinfo_f_cant_process_executable=09128;
   execinfo_f_cant_process_executable=09128;
   execinfo_f_cant_open_executable=09129;
   execinfo_f_cant_open_executable=09129;
   execinfo_x_codesize=09130;
   execinfo_x_codesize=09130;
@@ -903,9 +918,9 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 61274;
+  MsgTxtSize = 62105;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
-    26,89,314,104,85,54,112,23,202,63,
+    26,89,315,109,85,55,116,26,202,63,
     50,20,1,1,1,1,1,1,1,1
     50,20,1,1,1,1,1,1,1,1
   );
   );

+ 383 - 362
compiler/msgtxt.inc

@@ -1,7 +1,7 @@
 {$ifdef Delphi}
 {$ifdef Delphi}
-const msgtxt : array[0..000255] of string[240]=(
+const msgtxt : array[0..000258] of string[240]=(
 {$else Delphi}
 {$else Delphi}
-const msgtxt : array[0..000255,1..240] of char=(
+const msgtxt : array[0..000258,1..240] of char=(
 {$endif Delphi}
 {$endif Delphi}
   '01000_T_Compiler: $1'#000+
   '01000_T_Compiler: $1'#000+
   '01001_D_Compiler OS: $1'#000+
   '01001_D_Compiler OS: $1'#000+
@@ -495,594 +495,615 @@ const msgtxt : array[0..000255,1..240] of char=(
   'method resolutions'#000+
   'method resolutions'#000+
   '03313_E_Interface "$1" can'#039't have ','method resolutions, "$2" alrea'+
   '03313_E_Interface "$1" can'#039't have ','method resolutions, "$2" alrea'+
   'dy delegates it'#000+
   'dy delegates it'#000+
+  '03314_E_Invalid codepage'#000+
   '04000_E_Type mismatch'#000+
   '04000_E_Type mismatch'#000+
   '04001_E_Incompatible types: got "$1" expected "$2"'#000+
   '04001_E_Incompatible types: got "$1" expected "$2"'#000+
   '04002_E_Type mismatch between "$1" and "$2"'#000+
   '04002_E_Type mismatch between "$1" and "$2"'#000+
   '04003_E_Type identifier expected'#000+
   '04003_E_Type identifier expected'#000+
-  '04004_E_Variable identifier expected'#000+
-  '04005_E','_Integer expression expected, but got "$1"'#000+
+  '04004_E_Variable id','entifier expected'#000+
+  '04005_E_Integer expression expected, but got "$1"'#000+
   '04006_E_Boolean expression expected, but got "$1"'#000+
   '04006_E_Boolean expression expected, but got "$1"'#000+
   '04007_E_Ordinal expression expected'#000+
   '04007_E_Ordinal expression expected'#000+
   '04008_E_pointer type expected, but got "$1"'#000+
   '04008_E_pointer type expected, but got "$1"'#000+
-  '04009_E_class type expected, but got "$1"'#000+
-  '04011_E_Can'#039't evaluate co','nstant expression'#000+
+  '04009_E_class type expected, but got "$1"'#000,
+  '04011_E_Can'#039't evaluate constant expression'#000+
   '04012_E_Set elements are not compatible'#000+
   '04012_E_Set elements are not compatible'#000+
   '04013_E_Operation not implemented for sets'#000+
   '04013_E_Operation not implemented for sets'#000+
   '04014_W_Automatic type conversion from floating type to COMP which is '+
   '04014_W_Automatic type conversion from floating type to COMP which is '+
   'an integer type'#000+
   'an integer type'#000+
-  '04015_H_use DIV instead to get an integer result'#000+
-  '0401','6_E_String types have to match exactly in $V+ mode'#000+
+  '04015_H_use DIV instead to g','et an integer result'#000+
+  '04016_E_String types have to match exactly in $V+ mode'#000+
   '04017_E_succ or pred on enums with assignments not possible'#000+
   '04017_E_succ or pred on enums with assignments not possible'#000+
   '04018_E_Can'#039't read or write variables of this type'#000+
   '04018_E_Can'#039't read or write variables of this type'#000+
   '04019_E_Can'#039't use readln or writeln on typed file'#000+
   '04019_E_Can'#039't use readln or writeln on typed file'#000+
-  '04020_E_Can'#039't use read or wr','ite on untyped file.'#000+
+  '040','20_E_Can'#039't use read or write on untyped file.'#000+
   '04021_E_Type conflict between set elements'#000+
   '04021_E_Type conflict between set elements'#000+
   '04022_W_lo/hi(dword/qword) returns the upper/lower word/dword'#000+
   '04022_W_lo/hi(dword/qword) returns the upper/lower word/dword'#000+
   '04023_E_Integer or real expression expected'#000+
   '04023_E_Integer or real expression expected'#000+
-  '04024_E_Wrong type "$1" in array constructor'#000+
-  '04025_E_Incompatible type',' for arg no. $1: Got "$2", expected "$3"'#000+
+  '04024_E_Wrong type "$1" in array constructor'#000,
+  '04025_E_Incompatible type for arg no. $1: Got "$2", expected "$3"'#000+
   '04026_E_Method (variable) and Procedure (variable) are not compatible'#000+
   '04026_E_Method (variable) and Procedure (variable) are not compatible'#000+
   '04027_E_Illegal constant passed to internal math function'#000+
   '04027_E_Illegal constant passed to internal math function'#000+
-  '04028_E_Can'#039't take the address of constant expressions'#000+
-  '04029_E_Argument',' can'#039't be assigned to'#000+
+  '04028_E_Can'#039't take the address of constant exp','ressions'#000+
+  '04029_E_Argument can'#039't be assigned to'#000+
   '04030_E_Can'#039't assign local procedure/function to procedure variabl'+
   '04030_E_Can'#039't assign local procedure/function to procedure variabl'+
   'e'#000+
   'e'#000+
   '04031_E_Can'#039't assign values to an address'#000+
   '04031_E_Can'#039't assign values to an address'#000+
   '04032_E_Can'#039't assign values to const variable'#000+
   '04032_E_Can'#039't assign values to const variable'#000+
   '04033_E_Array type required'#000+
   '04033_E_Array type required'#000+
-  '04034_E_interface type expected, b','ut got "$1"'#000+
+  '04034_E_i','nterface type expected, but got "$1"'#000+
   '04035_H_Mixing signed expressions and longwords gives a 64bit result'#000+
   '04035_H_Mixing signed expressions and longwords gives a 64bit result'#000+
   '04036_W_Mixing signed expressions and cardinals here may cause a range'+
   '04036_W_Mixing signed expressions and cardinals here may cause a range'+
   ' check error'#000+
   ' check error'#000+
-  '04037_E_Typecast has different size ($1 -> $2) in assignment'#000+
-  '04038_E_enums w','ith assignments can'#039't be used as array index'#000+
+  '04037_E_Typecast has different size ($1 -> $2) in a','ssignment'#000+
+  '04038_E_enums with assignments can'#039't be used as array index'#000+
   '04039_E_Class or Object types "$1" and "$2" are not related'#000+
   '04039_E_Class or Object types "$1" and "$2" are not related'#000+
   '04040_W_Class types "$1" and "$2" are not related'#000+
   '04040_W_Class types "$1" and "$2" are not related'#000+
   '04041_E_Class or interface type expected, but got "$1"'#000+
   '04041_E_Class or interface type expected, but got "$1"'#000+
-  '04042_E_Type "$1" is not compl','etely defined'#000+
+  '04042','_E_Type "$1" is not completely defined'#000+
   '04043_W_String literal has more characters than short string length'#000+
   '04043_W_String literal has more characters than short string length'#000+
   '04044_W_Comparison might be always false due to range of constant and '+
   '04044_W_Comparison might be always false due to range of constant and '+
   'expression'#000+
   'expression'#000+
-  '04045_W_Comparison might be always true due to range of constant and e'+
-  'xpressi','on'#000+
+  '04045_W_Comparison might be always true due to range',' of constant and'+
+  ' expression'#000+
   '04046_W_Constructing a class "$1" with abstract method "$2"'#000+
   '04046_W_Constructing a class "$1" with abstract method "$2"'#000+
   '04047_H_The left operand of the IN operator should be byte sized'#000+
   '04047_H_The left operand of the IN operator should be byte sized'#000+
   '04048_W_Type size mismatch, possible loss of data / range check error'#000+
   '04048_W_Type size mismatch, possible loss of data / range check error'#000+
-  '04049_H_Type size mismatch, possible loss ','of data / range check erro'+
+  '04049_H_Type size',' mismatch, possible loss of data / range check erro'+
   'r'#000+
   'r'#000+
   '04050_E_The address of an abstract method can'#039't be taken'#000+
   '04050_E_The address of an abstract method can'#039't be taken'#000+
   '04051_E_Assignments to formal parameters and open arrays are not possi'+
   '04051_E_Assignments to formal parameters and open arrays are not possi'+
   'ble'#000+
   'ble'#000+
   '04052_E_Constant Expression expected'#000+
   '04052_E_Constant Expression expected'#000+
-  '04053_E_Operation "$1" not supported for typ','es "$2" and "$3"'#000+
+  '04053_E_Operation "','$1" not supported for types "$2" and "$3"'#000+
   '04054_E_Illegal type conversion: "$1" to "$2"'#000+
   '04054_E_Illegal type conversion: "$1" to "$2"'#000+
   '04055_H_Conversion between ordinals and pointers is not portable'#000+
   '04055_H_Conversion between ordinals and pointers is not portable'#000+
   '04056_W_Conversion between ordinals and pointers is not portable'#000+
   '04056_W_Conversion between ordinals and pointers is not portable'#000+
-  '04057_E_Can'#039't determine which overloaded functi','on to call'#000+
+  '04057_E_Can'#039't determin','e which overloaded function to call'#000+
   '04058_E_Illegal counter variable'#000+
   '04058_E_Illegal counter variable'#000+
   '04059_W_Converting constant real value to double for C variable argume'+
   '04059_W_Converting constant real value to double for C variable argume'+
   'nt, add explicit typecast to prevent this.'#000+
   'nt, add explicit typecast to prevent this.'#000+
-  '04060_E_Class or COM interface type expected, but got "$1"'#000+
-  '04061_E_Constant packed ','arrays are not yet supported'#000+
+  '04060_E_Class or COM interface type expected, but got "$1"',#000+
+  '04061_E_Constant packed arrays are not yet supported'#000+
   '04062_E_Incompatible type for arg no. $1: Got "$2" expected "(Bit)Pack'+
   '04062_E_Incompatible type for arg no. $1: Got "$2" expected "(Bit)Pack'+
   'ed Array"'#000+
   'ed Array"'#000+
   '04063_E_Incompatible type for arg no. $1: Got "$2" expected "(not pack'+
   '04063_E_Incompatible type for arg no. $1: Got "$2" expected "(not pack'+
   'ed) Array"'#000+
   'ed) Array"'#000+
-  '04064_E_Elements of packed arrays cannot be of a t','ype which need to '+
+  '04064_E_Elements of packe','d arrays cannot be of a type which need to '+
   'be initialised'#000+
   'be initialised'#000+
   '04065_E_Constant packed records and objects are not yet supported'#000+
   '04065_E_Constant packed records and objects are not yet supported'#000+
   '04066_W_Arithmetic "$1" on untyped pointer is unportable to {$T+}, sug'+
   '04066_W_Arithmetic "$1" on untyped pointer is unportable to {$T+}, sug'+
   'gest typecast'#000+
   'gest typecast'#000+
-  '04076_E_Can'#039't take address of a subroutine marked as loca','l'#000+
+  '04076_E_Can'#039't take address of a ','subroutine marked as local'#000+
   '04077_E_Can'#039't export subroutine marked as local from a unit'#000+
   '04077_E_Can'#039't export subroutine marked as local from a unit'#000+
   '04078_E_Type is not automatable: "$1"'#000+
   '04078_E_Type is not automatable: "$1"'#000+
   '04079_H_Converting the operands to "$1" before doing the add could pre'+
   '04079_H_Converting the operands to "$1" before doing the add could pre'+
   'vent overflow errors.'#000+
   'vent overflow errors.'#000+
-  '04080_H_Converting the operands to "$1" before d','oing the subtract co'+
+  '04080_H_Converting the ','operands to "$1" before doing the subtract co'+
   'uld prevent overflow errors.'#000+
   'uld prevent overflow errors.'#000+
   '04081_H_Converting the operands to "$1" before doing the multiply coul'+
   '04081_H_Converting the operands to "$1" before doing the multiply coul'+
   'd prevent overflow errors.'#000+
   'd prevent overflow errors.'#000+
-  '04082_W_Converting pointers to signed integers may result in wrong com'+
-  'parison results and rang','e errors, use an unsigned type instead.'#000+
+  '04082_W_Converting pointers to signed integers may result in wrong co',
+  'mparison results and range errors, use an unsigned type instead.'#000+
   '04083_E_Interface type $1 has no valid GUID'#000+
   '04083_E_Interface type $1 has no valid GUID'#000+
   '04084_E_Invalid selector name "$1"'#000+
   '04084_E_Invalid selector name "$1"'#000+
   '04085_E_Expected Objective-C method, but got $1'#000+
   '04085_E_Expected Objective-C method, but got $1'#000+
-  '04086_E_Expected Objective-C method or constant method name'#000+
-  '04087_E_No ty','pe info available for this type'#000+
+  '04086_E_Expected Objective-C method or constant ','method name'#000+
+  '04087_E_No type info available for this type'#000+
   '04088_E_Ordinal or string expression expected'#000+
   '04088_E_Ordinal or string expression expected'#000+
   '04089_E_String expression expected'#000+
   '04089_E_String expression expected'#000+
   '04090_W_Converting 0 to NIL'#000+
   '04090_W_Converting 0 to NIL'#000+
   '04091_E_Objective-C protocol type expected, but got "$1"'#000+
   '04091_E_Objective-C protocol type expected, but got "$1"'#000+
-  '04092_E_The type "$1" is not supported for',' interaction with the Obje'+
+  '04092_E_The type ','"$1" is not supported for interaction with the Obje'+
   'ctive-C runtime.'#000+
   'ctive-C runtime.'#000+
   '04093_E_Class or objcclass type expected, but got "$1"'#000+
   '04093_E_Class or objcclass type expected, but got "$1"'#000+
   '04094_E_Objcclass type expected'#000+
   '04094_E_Objcclass type expected'#000+
   '04095_W_Coerced univ parameter type in procedural variable may cause c'+
   '04095_W_Coerced univ parameter type in procedural variable may cause c'+
-  'rash or memory corruption: $1 to $2'#000+
-  '0409','6_E_Type parameters of specializations of generics cannot refere'+
-  'nce the currently specialized type'#000+
+  'rash or memory ','corruption: $1 to $2'#000+
+  '04096_E_Type parameters of specializations of generics cannot referenc'+
+  'e the currently specialized type'#000+
   '04097_E_Type parameters are not allowed on non-generic class/record/ob'+
   '04097_E_Type parameters are not allowed on non-generic class/record/ob'+
   'ject procedure or function'#000+
   'ject procedure or function'#000+
-  '04098_E_Generic declaration of "$1" differs ','from previous declaratio'+
+  '04098_E_Generic dec','laration of "$1" differs from previous declaratio'+
   'n'#000+
   'n'#000+
   '04099_E_Helper type expected'#000+
   '04099_E_Helper type expected'#000+
   '04100_E_Record type expected'#000+
   '04100_E_Record type expected'#000+
   '04101_E_Derived class helper must extend a subclass of "$1" or the cla'+
   '04101_E_Derived class helper must extend a subclass of "$1" or the cla'+
   'ss itself'#000+
   'ss itself'#000+
   '04102_E_Derived record helper must extend "$1"'#000+
   '04102_E_Derived record helper must extend "$1"'#000+
-  '04103_E_Invalid assignment, p','rocedures return no value'#000+
+  '0410','3_E_Invalid assignment, procedures return no value'#000+
+  '04104_W_Implicit string type conversion from "$1" to "$2"'#000+
+  '04105_W_Implicit string type conversion with potential data loss from '+
+  '"$1" to "$2"'#000+
+  '04106_-W_Explicit string typecast from "$1" to "','$2"'#000+
+  '04107_-W_Explicit string typecast with potential data loss from "$1" t'+
+  'o "$2"'#000+
+  '04108_W_Unicode constant cast with potential data loss'#000+
   '05000_E_Identifier not found "$1"'#000+
   '05000_E_Identifier not found "$1"'#000+
   '05001_F_Internal Error in SymTableStack()'#000+
   '05001_F_Internal Error in SymTableStack()'#000+
-  '05002_E_Duplicate identifier "$1"'#000+
+  '05002_E_Duplicate identifier',' "$1"'#000+
   '05003_H_Identifier already defined in $1 at line $2'#000+
   '05003_H_Identifier already defined in $1 at line $2'#000+
   '05004_E_Unknown identifier "$1"'#000+
   '05004_E_Unknown identifier "$1"'#000+
-  '05005_E_Forward decl','aration not solved "$1"'#000+
+  '05005_E_Forward declaration not solved "$1"'#000+
   '05007_E_Error in type definition'#000+
   '05007_E_Error in type definition'#000+
   '05009_E_Forward type not resolved "$1"'#000+
   '05009_E_Forward type not resolved "$1"'#000+
-  '05010_E_Only static variables can be used in static methods or outside'+
-  ' methods'#000+
+  '05010_E_Only static variables can ','be used in static methods or outsi'+
+  'de methods'#000+
   '05012_F_record or class type expected'#000+
   '05012_F_record or class type expected'#000+
-  '05013_E_Instances of classe','s or objects with an abstract method are '+
-  'not allowed'#000+
+  '05013_E_Instances of classes or objects with an abstract method are no'+
+  't allowed'#000+
   '05014_W_Label not defined "$1"'#000+
   '05014_W_Label not defined "$1"'#000+
   '05015_E_Label used but not defined "$1"'#000+
   '05015_E_Label used but not defined "$1"'#000+
-  '05016_E_Illegal label declaration'#000+
+  '05016_','E_Illegal label declaration'#000+
   '05017_E_GOTO and LABEL are not supported (use switch -Sg)'#000+
   '05017_E_GOTO and LABEL are not supported (use switch -Sg)'#000+
-  '05018_E_Label not found'#000,
+  '05018_E_Label not found'#000+
   '05019_E_identifier isn'#039't a label'#000+
   '05019_E_identifier isn'#039't a label'#000+
   '05020_E_label already defined'#000+
   '05020_E_label already defined'#000+
   '05021_E_illegal type declaration of set elements'#000+
   '05021_E_illegal type declaration of set elements'#000+
-  '05022_E_Forward class definition not resolved "$1"'#000+
+  '05022_E_Forward cl','ass definition not resolved "$1"'#000+
   '05023_H_Unit "$1" not used in $2'#000+
   '05023_H_Unit "$1" not used in $2'#000+
   '05024_H_Parameter "$1" not used'#000+
   '05024_H_Parameter "$1" not used'#000+
-  '05025_N_Loca','l variable "$1" not used'#000+
+  '05025_N_Local variable "$1" not used'#000+
   '05026_H_Value parameter "$1" is assigned but never used'#000+
   '05026_H_Value parameter "$1" is assigned but never used'#000+
-  '05027_N_Local variable "$1" is assigned but never used'#000+
+  '05027_N_Local variable "$1" is assigned but never',' used'#000+
   '05028_H_Local $1 "$2" is not used'#000+
   '05028_H_Local $1 "$2" is not used'#000+
   '05029_N_Private field "$1.$2" is never used'#000+
   '05029_N_Private field "$1.$2" is never used'#000+
-  '05030_N_Private field "$1.','$2" is assigned but never used'#000+
+  '05030_N_Private field "$1.$2" is assigned but never used'#000+
   '05031_N_Private method "$1.$2" never used'#000+
   '05031_N_Private method "$1.$2" never used'#000+
   '05032_E_Set type expected'#000+
   '05032_E_Set type expected'#000+
-  '05033_W_Function result does not seem to be set'#000+
+  '05033_W_Function result does no','t seem to be set'#000+
   '05034_W_Type "$1" is not aligned correctly in current record for C'#000+
   '05034_W_Type "$1" is not aligned correctly in current record for C'#000+
-  '05035_E_Unknown record fie','ld identifier "$1"'#000+
+  '05035_E_Unknown record field identifier "$1"'#000+
   '05036_W_Local variable "$1" does not seem to be initialized'#000+
   '05036_W_Local variable "$1" does not seem to be initialized'#000+
-  '05037_W_Variable "$1" does not seem to be initialized'#000+
+  '05037_W_Variable "$1" does not seem to be initializ','ed'#000+
   '05038_E_identifier idents no member "$1"'#000+
   '05038_E_identifier idents no member "$1"'#000+
   '05039_H_Found declaration: $1'#000+
   '05039_H_Found declaration: $1'#000+
   '05040_E_Data element too large'#000+
   '05040_E_Data element too large'#000+
-  '05042','_E_No matching implementation for interface method "$1" found'#000+
+  '05042_E_No matching implementation for interface method "$1" found'#000+
   '05043_W_Symbol "$1" is deprecated'#000+
   '05043_W_Symbol "$1" is deprecated'#000+
-  '05044_W_Symbol "$1" is not portable'#000+
+  '05044_W_Symbol "$1" is not portabl','e'#000+
   '05055_W_Symbol "$1" is not implemented'#000+
   '05055_W_Symbol "$1" is not implemented'#000+
   '05056_E_Can'#039't create unique type from this type'#000+
   '05056_E_Can'#039't create unique type from this type'#000+
-  '05057_H_Local variabl','e "$1" does not seem to be initialized'#000+
+  '05057_H_Local variable "$1" does not seem to be initialized'#000+
   '05058_H_Variable "$1" does not seem to be initialized'#000+
   '05058_H_Variable "$1" does not seem to be initialized'#000+
-  '05059_W_Function result variable does not seem to initialized'#000+
+  '05059_W_Function result variable does',' not seem to initialized'#000+
   '05060_H_Function result variable does not seem to be initialized'#000+
   '05060_H_Function result variable does not seem to be initialized'#000+
-  '05061_W_Variable "$1','" read but nowhere assigned'#000+
+  '05061_W_Variable "$1" read but nowhere assigned'#000+
   '05062_H_Found abstract method: $1'#000+
   '05062_H_Found abstract method: $1'#000+
   '05063_W_Symbol "$1" is experimental'#000+
   '05063_W_Symbol "$1" is experimental'#000+
-  '05064_W_Forward declaration "$1" not resolved, assumed external'#000+
+  '05064_W_Forward declaration "$1"',' not resolved, assumed external'#000+
   '05065_W_Symbol "$1" is belongs to a library'#000+
   '05065_W_Symbol "$1" is belongs to a library'#000+
-  '05066_W_Symbol "$1" is deprecated:',' "$2"'#000+
+  '05066_W_Symbol "$1" is deprecated: "$2"'#000+
   '05067_E_Cannot find an enumerator for the type "$1"'#000+
   '05067_E_Cannot find an enumerator for the type "$1"'#000+
   '05068_E_Cannot find a "MoveNext" method in enumerator "$1"'#000+
   '05068_E_Cannot find a "MoveNext" method in enumerator "$1"'#000+
-  '05069_E_Cannot find a "Current" property in enumerator "$1"'#000+
-  '05070_E_Mismatch between number of declared parameters and numb','er of'+
-  ' colons in message string.'#000+
+  '05069_E_Canno','t find a "Current" property in enumerator "$1"'#000+
+  '05070_E_Mismatch between number of declared parameters and number of c'+
+  'olons in message string.'#000+
   '05071_N_Private type "$1.$2" never used'#000+
   '05071_N_Private type "$1.$2" never used'#000+
   '05072_N_Private const "$1.$2" never used'#000+
   '05072_N_Private const "$1.$2" never used'#000+
-  '05073_N_Private property "$1.$2" never used'#000+
+  '05073_N_Private p','roperty "$1.$2" never used'#000+
   '05074_W_Unit "$1" is deprecated'#000+
   '05074_W_Unit "$1" is deprecated'#000+
   '05075_W_Unit "$1" is deprecated: "$2"'#000+
   '05075_W_Unit "$1" is deprecated: "$2"'#000+
-  '05076_W_Unit ','"$1" is not portable'#000+
+  '05076_W_Unit "$1" is not portable'#000+
   '05077_W_Unit "$1" is belongs to a library'#000+
   '05077_W_Unit "$1" is belongs to a library'#000+
   '05078_W_Unit "$1" is not implemented'#000+
   '05078_W_Unit "$1" is not implemented'#000+
-  '05079_W_Unit "$1" is experimental'#000+
+  '05079_W_Unit "$1" is experimen','tal'#000+
   '05080_E_No complete definition of the formally declared objcclass "$1"'+
   '05080_E_No complete definition of the formally declared objcclass "$1"'+
   ' is in scope'#000+
   ' is in scope'#000+
-  '05081_E_Gotos into init','ialization or finalization blocks of units ar'+
-  'e not allowed'#000+
+  '05081_E_Gotos into initialization or finalization blocks of units are '+
+  'not allowed'#000+
   '05082_E_Invalid external name "$1" for formal class "$2"'#000+
   '05082_E_Invalid external name "$1" for formal class "$2"'#000+
-  '05083_E_Complete class definition with external name "$1" here'#000+
-  '05084_W_Possible library conflict: symbol "$1" from library "','$2" als'+
-  'o found in library "$3"'#000+
+  '05083_E_Comple','te class definition with external name "$1" here'#000+
+  '05084_W_Possible library conflict: symbol "$1" from library "$2" also '+
+  'found in library "$3"'#000+
   '06009_E_Parameter list size exceeds 65535 bytes'#000+
   '06009_E_Parameter list size exceeds 65535 bytes'#000+
   '06012_E_File types must be var parameters'#000+
   '06012_E_File types must be var parameters'#000+
-  '06013_E_The use of a far pointer isn'#039't allowed there'#000+
+  '06013_E_T','he use of a far pointer isn'#039't allowed there'#000+
   '06015_E_EXPORT declared functions can'#039't be called'#000+
   '06015_E_EXPORT declared functions can'#039't be called'#000+
-  '06016_W_Possible',' illegal call of constructor or destructor'#000+
+  '06016_W_Possible illegal call of constructor or destructor'#000+
   '06017_N_Inefficient code'#000+
   '06017_N_Inefficient code'#000+
   '06018_W_unreachable code'#000+
   '06018_W_unreachable code'#000+
-  '06020_E_Abstract methods can'#039't be called directly'#000+
+  '06020_E_Abstract methods can'#039't be cal','led directly'#000+
   '06027_DL_Register $1 weight $2 $3'#000+
   '06027_DL_Register $1 weight $2 $3'#000+
   '06029_DL_Stack frame is omitted'#000+
   '06029_DL_Stack frame is omitted'#000+
-  '06031_E_Object or class methods',' can'#039't be inline.'#000+
+  '06031_E_Object or class methods can'#039't be inline.'#000+
   '06032_E_Procvar calls cannot be inline.'#000+
   '06032_E_Procvar calls cannot be inline.'#000+
   '06033_E_No code for inline procedure stored'#000+
   '06033_E_No code for inline procedure stored'#000+
-  '06035_E_Element zero of an ansi/wide- or longstring can'#039't be acces'+
-  'sed, use (set)length instead'#000+
-  '06037_E_Constructors or destructors cannot ','be called inside a '#039'w'+
-  'ith'#039' clause'#000+
+  '06035_E_Element zero of an a','nsi/wide- or longstring can'#039't be acc'+
+  'essed, use (set)length instead'#000+
+  '06037_E_Constructors or destructors cannot be called inside a '#039'wit'+
+  'h'#039' clause'#000+
   '06038_E_Cannot call message handler methods directly'#000+
   '06038_E_Cannot call message handler methods directly'#000+
-  '06039_E_Jump in or outside of an exception block'#000+
+  '06039_E_Jump in or outside of an exception b','lock'#000+
   '06040_E_Control flow statements aren'#039't allowed in a finally block'#000+
   '06040_E_Control flow statements aren'#039't allowed in a finally block'#000+
-  '06041_W_Parameters size exceeds limit f','or certain cpu'#039's'#000+
+  '06041_W_Parameters size exceeds limit for certain cpu'#039's'#000+
   '06042_W_Local variable size exceed limit for certain cpu'#039's'#000+
   '06042_W_Local variable size exceed limit for certain cpu'#039's'#000+
   '06043_E_Local variables size exceeds supported limit'#000+
   '06043_E_Local variables size exceeds supported limit'#000+
-  '06044_E_BREAK not allowed'#000+
+  '0','6044_E_BREAK not allowed'#000+
   '06045_E_CONTINUE not allowed'#000+
   '06045_E_CONTINUE not allowed'#000+
-  '06046_F_Unknown compilerproc "$1". Check if you use the ','correct run '+
-  'time library.'#000+
+  '06046_F_Unknown compilerproc "$1". Check if you use the correct run ti'+
+  'me library.'#000+
   '06047_F_Cannot find system type "$1". Check if you use the correct run'+
   '06047_F_Cannot find system type "$1". Check if you use the correct run'+
   ' time library.'#000+
   ' time library.'#000+
-  '06048_H_Inherited call to abstract method ignored'#000+
+  '06048_H_Inherited c','all to abstract method ignored'#000+
   '06049_E_Goto label "$1" not defined or optimized away'#000+
   '06049_E_Goto label "$1" not defined or optimized away'#000+
-  '06050_F_Cannot find type ','"$1" in unit "$2". Check if you use the cor'+
-  'rect run time library.'#000+
-  '06051_E_Interprocedural gotos are allowed only to outer subroutines'#000+
+  '06050_F_Cannot find type "$1" in unit "$2". Check if you use the corre'+
+  'ct run time library.'#000+
+  '06051_E_Interprocedural gotos are allowed only to outer subrouti','nes'#000+
   '06052_E_Label must be defined in the same scope as it is declared'#000+
   '06052_E_Label must be defined in the same scope as it is declared'#000+
-  '06053_E_Leaving procedures containing ex','plicit or implicit exception'+
-  's frames using goto is not allowed'#000+
+  '06053_E_Leaving procedures containing explicit or implicit exceptions '+
+  'frames using goto is not allowed'#000+
+  '06054_E_In ISO mode, the mod operator is defined only for positive ','q'+
+  'uotient'#000+
   '07000_DL_Starting $1 styled assembler parsing'#000+
   '07000_DL_Starting $1 styled assembler parsing'#000+
   '07001_DL_Finished $1 styled assembler parsing'#000+
   '07001_DL_Finished $1 styled assembler parsing'#000+
   '07002_E_Non-label pattern contains @'#000+
   '07002_E_Non-label pattern contains @'#000+
   '07004_E_Error building record offset'#000+
   '07004_E_Error building record offset'#000+
-  '07005_E_OFF','SET used without identifier'#000+
-  '07006_E_TYPE used without identifier'#000+
+  '07005_E_OFFSET used without identifier'#000+
+  '07006_E_TYPE used without ','identifier'#000+
   '07007_E_Cannot use local variable or parameters here'#000+
   '07007_E_Cannot use local variable or parameters here'#000+
   '07008_E_need to use OFFSET here'#000+
   '07008_E_need to use OFFSET here'#000+
   '07009_E_need to use $ here'#000+
   '07009_E_need to use $ here'#000+
   '07010_E_Cannot use multiple relocatable symbols'#000+
   '07010_E_Cannot use multiple relocatable symbols'#000+
-  '07011_E_Relocat','able symbol can only be added'#000+
-  '07012_E_Invalid constant expression'#000+
+  '07011_E_Relocatable symbol can only be added'#000+
+  '07012_E_Invalid constant',' expression'#000+
   '07013_E_Relocatable symbol is not allowed'#000+
   '07013_E_Relocatable symbol is not allowed'#000+
   '07014_E_Invalid reference syntax'#000+
   '07014_E_Invalid reference syntax'#000+
   '07015_E_You cannot reach $1 from that code'#000+
   '07015_E_You cannot reach $1 from that code'#000+
-  '07016_E_Local symbols/labels aren'#039't allowed as reference','s'#000+
+  '07016_E_Local symbols/labels aren'#039't allowed as references'#000+
   '07017_E_Invalid base and index register usage'#000+
   '07017_E_Invalid base and index register usage'#000+
-  '07018_W_Possible error in object field handling'#000+
+  '07018_','W_Possible error in object field handling'#000+
   '07019_E_Wrong scale factor specified'#000+
   '07019_E_Wrong scale factor specified'#000+
   '07020_E_Multiple index register usage'#000+
   '07020_E_Multiple index register usage'#000+
   '07021_E_Invalid operand type'#000+
   '07021_E_Invalid operand type'#000+
-  '07022_E_Invalid string as opcode operand',': $1'#000+
+  '07022_E_Invalid string as opcode operand: $1'#000+
   '07023_W_@CODE and @DATA not supported'#000+
   '07023_W_@CODE and @DATA not supported'#000+
-  '07024_E_Null label references are not allowed'#000+
+  '07024_E_Nul','l label references are not allowed'#000+
   '07025_E_Divide by zero in asm evaluator'#000+
   '07025_E_Divide by zero in asm evaluator'#000+
   '07026_E_Illegal expression'#000+
   '07026_E_Illegal expression'#000+
   '07027_E_escape sequence ignored: $1'#000+
   '07027_E_escape sequence ignored: $1'#000+
   '07028_E_Invalid symbol reference'#000+
   '07028_E_Invalid symbol reference'#000+
-  '07029_W_Fwait c','an cause emulation problems with emu387'#000+
-  '07030_W_$1 without operand translated into $1P'#000+
+  '07029_W_Fwait can cause emulation problems with emu387'#000+
+  '07030_W_$1 wit','hout operand translated into $1P'#000+
   '07031_W_ENTER instruction is not supported by Linux kernel'#000+
   '07031_W_ENTER instruction is not supported by Linux kernel'#000+
   '07032_W_Calling an overload function in assembler'#000+
   '07032_W_Calling an overload function in assembler'#000+
-  '07033_E_Unsupported symbol type for operand'#000,
+  '07033_E_Unsupported symbol type for operand'#000+
   '07034_E_Constant value out of bounds'#000+
   '07034_E_Constant value out of bounds'#000+
-  '07035_E_Error converting decimal $1'#000+
+  '07035_E_Error con','verting decimal $1'#000+
   '07036_E_Error converting octal $1'#000+
   '07036_E_Error converting octal $1'#000+
   '07037_E_Error converting binary $1'#000+
   '07037_E_Error converting binary $1'#000+
   '07038_E_Error converting hexadecimal $1'#000+
   '07038_E_Error converting hexadecimal $1'#000+
   '07039_H_$1 translated to $2'#000+
   '07039_H_$1 translated to $2'#000+
-  '07040_W_$1 is associated to an',' overloaded function'#000+
-  '07041_E_Cannot use SELF outside a method'#000+
+  '07040_W_$1 is associated to an overloaded function'#000+
+  '07041_E_Cannot use SELF outside a',' method'#000+
   '07042_E_Cannot use OLDEBP outside a nested procedure'#000+
   '07042_E_Cannot use OLDEBP outside a nested procedure'#000+
   '07043_W_Procedures can'#039't return any value in asm code'#000+
   '07043_W_Procedures can'#039't return any value in asm code'#000+
   '07044_E_SEG not supported'#000+
   '07044_E_SEG not supported'#000+
-  '07045_E_Size suffix and destination or source',' size do not match'#000+
-  '07046_W_Size suffix and destination or source size do not match'#000+
+  '07045_E_Size suffix and destination or source size do not match'#000+
+  '07046_W_Size suffix and destination',' or source size do not match'#000+
   '07047_E_Assembler syntax error'#000+
   '07047_E_Assembler syntax error'#000+
   '07048_E_Invalid combination of opcode and operands'#000+
   '07048_E_Invalid combination of opcode and operands'#000+
   '07049_E_Assembler syntax error in operand'#000+
   '07049_E_Assembler syntax error in operand'#000+
-  '07050_E_Assembler syntax error in',' constant'#000+
+  '07050_E_Assembler syntax error in constant'#000+
   '07051_E_Invalid String expression'#000+
   '07051_E_Invalid String expression'#000+
-  '07052_W_constant with symbol $1 for address which is not on a pointer'#000+
+  '07052_W_co','nstant with symbol $1 for address which is not on a pointe'+
+  'r'#000+
   '07053_E_Unrecognized opcode $1'#000+
   '07053_E_Unrecognized opcode $1'#000+
   '07054_E_Invalid or missing opcode'#000+
   '07054_E_Invalid or missing opcode'#000+
   '07055_E_Invalid combination of prefix and opcode: $1'#000+
   '07055_E_Invalid combination of prefix and opcode: $1'#000+
-  '07056_E_','Invalid combination of override and opcode: $1'#000+
-  '07057_E_Too many operands on line'#000+
+  '07056_E_Invalid combination of override and opcode: $1'#000+
+  '07057_E','_Too many operands on line'#000+
   '07058_W_NEAR ignored'#000+
   '07058_W_NEAR ignored'#000+
   '07059_W_FAR ignored'#000+
   '07059_W_FAR ignored'#000+
   '07060_E_Duplicate local symbol $1'#000+
   '07060_E_Duplicate local symbol $1'#000+
   '07061_E_Undefined local symbol $1'#000+
   '07061_E_Undefined local symbol $1'#000+
   '07062_E_Unknown label identifier $1'#000+
   '07062_E_Unknown label identifier $1'#000+
-  '07063_E_Invali','d register name'#000+
-  '07064_E_Invalid floating point register name'#000+
+  '07063_E_Invalid register name'#000+
+  '07064_E_Invalid floating point registe','r name'#000+
   '07066_W_Modulo not supported'#000+
   '07066_W_Modulo not supported'#000+
   '07067_E_Invalid floating point constant $1'#000+
   '07067_E_Invalid floating point constant $1'#000+
   '07068_E_Invalid floating point expression'#000+
   '07068_E_Invalid floating point expression'#000+
   '07069_E_Wrong symbol type'#000+
   '07069_E_Wrong symbol type'#000+
-  '07070_E_Cannot index a local var or par','ameter with a register'#000+
-  '07071_E_Invalid segment override expression'#000+
+  '07070_E_Cannot index a local var or parameter with a register'#000+
+  '07071_E_Invalid segment overrid','e expression'#000+
   '07072_W_Identifier $1 supposed external'#000+
   '07072_W_Identifier $1 supposed external'#000+
   '07073_E_Strings not allowed as constants'#000+
   '07073_E_Strings not allowed as constants'#000+
   '07074_E_No type of variable specified'#000+
   '07074_E_No type of variable specified'#000+
   '07075_E_assembler code not returned to text section'#000+
   '07075_E_assembler code not returned to text section'#000+
-  '07','076_E_Not a directive or local symbol $1'#000+
-  '07077_E_Using a defined name as a local label'#000+
+  '07076_E_Not a directive or local symbol $1'#000+
+  '07077_E_Using',' a defined name as a local label'#000+
   '07078_E_Dollar token is used without an identifier'#000+
   '07078_E_Dollar token is used without an identifier'#000+
   '07079_W_32bit constant created for address'#000+
   '07079_W_32bit constant created for address'#000+
-  '07080_N_.align is target specific, use .balign or .p2align'#000,
+  '07080_N_.align is target specific, use .balign or .p2align'#000+
   '07081_E_Can'#039't access fields directly for parameters'#000+
   '07081_E_Can'#039't access fields directly for parameters'#000+
-  '07082_E_Can'#039't access fields of objects/classes directly'#000+
+  '07','082_E_Can'#039't access fields of objects/classes directly'#000+
   '07083_E_No size specified and unable to determine the size of the oper'+
   '07083_E_No size specified and unable to determine the size of the oper'+
   'ands'#000+
   'ands'#000+
   '07084_E_Cannot use RESULT in this function'#000+
   '07084_E_Cannot use RESULT in this function'#000+
-  '07086_W_"$1" w','ithout operand translated into "$1 %st,%st(1)"'#000+
-  '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+
+  '07086_W_"$1" without operand translated into "$1 %st,%st(1)"'#000+
+  '07087_W','_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+
   '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+
   '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+
   '07089_E_Char < not allowed here'#000+
   '07089_E_Char < not allowed here'#000+
   '07090_E_Char > not allowed here'#000+
   '07090_E_Char > not allowed here'#000+
-  '07093_W_ALIGN not support','ed'#000+
+  '07093_W_ALIGN not supported'#000+
   '07094_E_Inc and Dec cannot be together'#000+
   '07094_E_Inc and Dec cannot be together'#000+
-  '07095_E_Invalid reglist for movem'#000+
+  '07095_E_Inva','lid reglist for movem'#000+
   '07096_E_Reglist invalid for opcode'#000+
   '07096_E_Reglist invalid for opcode'#000+
   '07097_E_Higher cpu mode required ($1)'#000+
   '07097_E_Higher cpu mode required ($1)'#000+
   '07098_W_No size specified and unable to determine the size of the oper'+
   '07098_W_No size specified and unable to determine the size of the oper'+
-  'ands, using DWORD as ','default'#000+
-  '07099_E_Syntax error while trying to parse a shifter operand'#000+
+  'ands, using DWORD as default'#000+
+  '07099_E_Syntax error while trying to parse a s','hifter operand'#000+
   '07100_E_Address of packed component is not at a byte boundary'#000+
   '07100_E_Address of packed component is not at a byte boundary'#000+
   '07101_W_No size specified and unable to determine the size of the oper'+
   '07101_W_No size specified and unable to determine the size of the oper'+
   'ands, using BYTE as default'#000+
   'ands, using BYTE as default'#000+
-  '07102_W_Use',' of +offset(%ebp) for parameters invalid here'#000+
-  '07103_W_Use of +offset(%ebp) is not compatible with regcall convention'+
-  #000+
+  '07102_W_Use of +offset(%ebp) for parameters invalid here'#000+
+  '07103_W_','Use of +offset(%ebp) is not compatible with regcall conventi'+
+  'on'#000+
   '07104_W_Use of -offset(%ebp) is not recommended for local variable acc'+
   '07104_W_Use of -offset(%ebp) is not recommended for local variable acc'+
   'ess'#000+
   'ess'#000+
-  '07105_W_Use of -offset(%esp), access may cause a ','crash or value may '+
-  'be lost'#000+
-  '07106_E_VMTOffset must be used in combination with a virtual method, a'+
-  'nd "$1" is not virtual'#000+
+  '07105_W_Use of -offset(%esp), access may cause a crash or value may be'+
+  ' lost'#000+
+  '07106_E_VMTOffset must be u','sed in combination with a virtual method,'+
+  ' and "$1" is not virtual'#000+
   '07107_E_Generating PIC, but reference is not PIC-safe'#000+
   '07107_E_Generating PIC, but reference is not PIC-safe'#000+
-  '07108_E_All registers in a register set must be of the same kind a','nd'+
-  ' width'#000+
+  '07108_E_All registers in a register set must be of the same kind and w'+
+  'idth'#000+
   '07109_E_A register set cannot be empty'#000+
   '07109_E_A register set cannot be empty'#000+
-  '07110_W_@GOTPCREL is useless and potentially dangereous for local symb'+
-  'ols'#000+
+  '07110_','W_@GOTPCREL is useless and potentially dangereous for local sy'+
+  'mbols'#000+
   '07111_W_Constant with general purpose segment register'#000+
   '07111_W_Constant with general purpose segment register'#000+
+  '07112_E_Invalid offset value for $1'#000+
+  '07113_E_Invalid register for $1'#000+
+  '07114_E_SEH directives are allowed only in pure a','ssembler procedures'+
+  #000+
+  '07115_E_Directive "$1" is not supported for the current target'#000+
   '08000_F_Too many assembler files'#000+
   '08000_F_Too many assembler files'#000+
-  '08001_F_Selected assembler out','put not supported'#000+
+  '08001_F_Selected assembler output not supported'#000+
   '08002_F_Comp not supported'#000+
   '08002_F_Comp not supported'#000+
   '08003_F_Direct not support for binary writers'#000+
   '08003_F_Direct not support for binary writers'#000+
-  '08004_E_Allocating of data is only allowed in bss section'#000+
+  '080','04_E_Allocating of data is only allowed in bss section'#000+
   '08005_F_No binary writer selected'#000+
   '08005_F_No binary writer selected'#000+
   '08006_E_Asm: Opcode $1 not in table'#000+
   '08006_E_Asm: Opcode $1 not in table'#000+
-  '08007_E_Asm: $1 inval','id combination of opcode and operands'#000+
+  '08007_E_Asm: $1 invalid combination of opcode and operands'#000+
   '08008_E_Asm: 16 Bit references not supported'#000+
   '08008_E_Asm: 16 Bit references not supported'#000+
-  '08009_E_Asm: Invalid effective address'#000+
+  '08009_E_Asm',': Invalid effective address'#000+
   '08010_E_Asm: Immediate or reference expected'#000+
   '08010_E_Asm: Immediate or reference expected'#000+
   '08011_E_Asm: $1 value exceeds bounds $2'#000+
   '08011_E_Asm: $1 value exceeds bounds $2'#000+
-  '08012_E_Asm: Short jump is out of',' range $1'#000+
+  '08012_E_Asm: Short jump is out of range $1'#000+
   '08013_E_Asm: Undefined label $1'#000+
   '08013_E_Asm: Undefined label $1'#000+
-  '08014_E_Asm: Comp type not supported for this target'#000+
+  '08014_E_Asm: Comp type not supported for this target',#000+
   '08015_E_Asm: Extended type not supported for this target'#000+
   '08015_E_Asm: Extended type not supported for this target'#000+
   '08016_E_Asm: Duplicate label $1'#000+
   '08016_E_Asm: Duplicate label $1'#000+
   '08017_E_Asm: Redefined label $1'#000+
   '08017_E_Asm: Redefined label $1'#000+
-  '08018_E_Asm: First defin','ed here'#000+
+  '08018_E_Asm: First defined here'#000+
   '08019_E_Asm: Invalid register $1'#000+
   '08019_E_Asm: Invalid register $1'#000+
   '08020_E_Asm: 16 or 32 Bit references not supported'#000+
   '08020_E_Asm: 16 or 32 Bit references not supported'#000+
-  '08021_E_Asm: 64 Bit operands not supported'#000+
+  '08','021_E_Asm: 64 Bit operands not supported'#000+
   '08022_E_Asm: AH,BH,CH or DH cannot be used in an instruction requiring'+
   '08022_E_Asm: AH,BH,CH or DH cannot be used in an instruction requiring'+
   ' REX prefix'#000+
   ' REX prefix'#000+
-  '09000_W_Source operatin','g system redefined'#000+
+  '08023_E_Missing .seh_endprologue directive'#000+
+  '08024_E_Function prologue exceeds 255 bytes'#000+
+  '08025_E_.seh_handlerdata direc','tive without preceding .seh_handler'#000+
+  '09000_W_Source operating system redefined'#000+
   '09001_I_Assembling (pipe) $1'#000+
   '09001_I_Assembling (pipe) $1'#000+
   '09002_E_Can'#039't create assembler file: $1'#000+
   '09002_E_Can'#039't create assembler file: $1'#000+
   '09003_E_Can'#039't create object file: $1'#000+
   '09003_E_Can'#039't create object file: $1'#000+
   '09004_E_Can'#039't create archive file: $1'#000+
   '09004_E_Can'#039't create archive file: $1'#000+
-  '09005_E_Assembler $1 not found, switching to external assembling'#000+
-  '09006_T_Usin','g assembler: $1'#000+
+  '09005_E_Assembler ','$1 not found, switching to external assembling'#000+
+  '09006_T_Using assembler: $1'#000+
   '09007_E_Error while assembling exitcode $1'#000+
   '09007_E_Error while assembling exitcode $1'#000+
   '09008_E_Can'#039't call the assembler, error $1 switching to external a'+
   '09008_E_Can'#039't call the assembler, error $1 switching to external a'+
   'ssembling'#000+
   'ssembling'#000+
   '09009_I_Assembling $1'#000+
   '09009_I_Assembling $1'#000+
-  '09010_I_Assembling with smartlinking $1'#000+
-  '09011_W_Object $1 not found, Linking may fa','il !'#000+
+  '09010_I_Assembling with ','smartlinking $1'#000+
+  '09011_W_Object $1 not found, Linking may fail !'#000+
   '09012_W_Library $1 not found, Linking may fail !'#000+
   '09012_W_Library $1 not found, Linking may fail !'#000+
   '09013_E_Error while linking'#000+
   '09013_E_Error while linking'#000+
   '09014_E_Can'#039't call the linker, switching to external linking'#000+
   '09014_E_Can'#039't call the linker, switching to external linking'#000+
   '09015_I_Linking $1'#000+
   '09015_I_Linking $1'#000+
-  '09016_E_Util $1 not found, switching to external linking'#000+
-  '09017_T_Using util $1',#000+
+  '09016_E_Util $1 not',' found, switching to external linking'#000+
+  '09017_T_Using util $1'#000+
   '09018_E_Creation of Executables not supported'#000+
   '09018_E_Creation of Executables not supported'#000+
   '09019_E_Creation of Dynamic/Shared Libraries not supported'#000+
   '09019_E_Creation of Dynamic/Shared Libraries not supported'#000+
   '09020_I_Closing script $1'#000+
   '09020_I_Closing script $1'#000+
-  '09021_E_resource compiler "$1" not found, switching to external mode'#000+
+  '09021_E_resource compiler "$1" not found, switchi','ng to external mode'+
+  #000+
   '09022_I_Compiling resource $1'#000+
   '09022_I_Compiling resource $1'#000+
-  '09023_T_u','nit $1 can'#039't be statically linked, switching to smart l'+
-  'inking'#000+
+  '09023_T_unit $1 can'#039't be statically linked, switching to smart lin'+
+  'king'#000+
   '09024_T_unit $1 can'#039't be smart linked, switching to static linking'+
   '09024_T_unit $1 can'#039't be smart linked, switching to static linking'+
   #000+
   #000+
-  '09025_T_unit $1 can'#039't be shared linked, switching to static linkin'+
-  'g'#000+
-  '09026_E_unit $1 can'#039't be smart or static li','nked'#000+
+  '09025_T_unit $1 can'#039't be shared linked, switching to',' static link'+
+  'ing'#000+
+  '09026_E_unit $1 can'#039't be smart or static linked'#000+
   '09027_E_unit $1 can'#039't be shared or static linked'#000+
   '09027_E_unit $1 can'#039't be shared or static linked'#000+
   '09028_D_Calling resource compiler "$1" with "$2" as command line'#000+
   '09028_D_Calling resource compiler "$1" with "$2" as command line'#000+
   '09029_E_Error while compiling resources'#000+
   '09029_E_Error while compiling resources'#000+
-  '09030_E_Can'#039't call the resource compiler "$1", switching to extern'+
-  'al mode'#000+
-  '09031_E','_Can'#039't open resource file "$1"'#000+
+  '09030_E_Can'#039't call the',' resource compiler "$1", switching to exte'+
+  'rnal mode'#000+
+  '09031_E_Can'#039't open resource file "$1"'#000+
   '09032_E_Can'#039't write resource file "$1"'#000+
   '09032_E_Can'#039't write resource file "$1"'#000+
+  '09033_N_File "$1" not found for backquoted cat command'#000+
   '09128_F_Can'#039't post process executable $1'#000+
   '09128_F_Can'#039't post process executable $1'#000+
-  '09129_F_Can'#039't open executable $1'#000+
+  '09129_F_Can'#039't o','pen executable $1'#000+
   '09130_X_Size of Code: $1 bytes'#000+
   '09130_X_Size of Code: $1 bytes'#000+
   '09131_X_Size of initialized data: $1 bytes'#000+
   '09131_X_Size of initialized data: $1 bytes'#000+
-  '09132_X_Size of uninit','ialized data: $1 bytes'#000+
+  '09132_X_Size of uninitialized data: $1 bytes'#000+
   '09133_X_Stack space reserved: $1 bytes'#000+
   '09133_X_Stack space reserved: $1 bytes'#000+
   '09134_X_Stack space committed: $1 bytes'#000+
   '09134_X_Stack space committed: $1 bytes'#000+
-  '09200_F_Executable image size is too big for $1 target.'#000+
+  '09200_F_Executable image',' size is too big for $1 target.'#000+
   '09201_W_Object file "$1" contains 32-bit absolute relocation to symbol'+
   '09201_W_Object file "$1" contains 32-bit absolute relocation to symbol'+
   ' "$2".'#000+
   ' "$2".'#000+
-  '10000','_T_Unitsearch: $1'#000+
+  '10000_T_Unitsearch: $1'#000+
   '10001_T_PPU Loading $1'#000+
   '10001_T_PPU Loading $1'#000+
   '10002_U_PPU Name: $1'#000+
   '10002_U_PPU Name: $1'#000+
   '10003_U_PPU Flags: $1'#000+
   '10003_U_PPU Flags: $1'#000+
   '10004_U_PPU Crc: $1'#000+
   '10004_U_PPU Crc: $1'#000+
   '10005_U_PPU Time: $1'#000+
   '10005_U_PPU Time: $1'#000+
-  '10006_U_PPU File too short'#000+
+  '1','0006_U_PPU File too short'#000+
   '10007_U_PPU Invalid Header (no PPU at the begin)'#000+
   '10007_U_PPU Invalid Header (no PPU at the begin)'#000+
   '10008_U_PPU Invalid Version $1'#000+
   '10008_U_PPU Invalid Version $1'#000+
-  '10009_U_','PPU is compiled for another processor'#000+
+  '10009_U_PPU is compiled for another processor'#000+
   '10010_U_PPU is compiled for another target'#000+
   '10010_U_PPU is compiled for another target'#000+
   '10011_U_PPU Source: $1'#000+
   '10011_U_PPU Source: $1'#000+
   '10012_U_Writing $1'#000+
   '10012_U_Writing $1'#000+
-  '10013_F_Can'#039't Write PPU-File'#000+
+  '100','13_F_Can'#039't Write PPU-File'#000+
   '10014_F_Error reading PPU-File'#000+
   '10014_F_Error reading PPU-File'#000+
   '10015_F_unexpected end of PPU-File'#000+
   '10015_F_unexpected end of PPU-File'#000+
-  '10016_F_Invalid PPU-Fi','le entry: $1'#000+
+  '10016_F_Invalid PPU-File entry: $1'#000+
   '10017_F_PPU Dbx count problem'#000+
   '10017_F_PPU Dbx count problem'#000+
   '10018_E_Illegal unit name: $1'#000+
   '10018_E_Illegal unit name: $1'#000+
   '10019_F_Too much units'#000+
   '10019_F_Too much units'#000+
-  '10020_F_Circular unit reference between $1 and $2'#000+
+  '10020_F_Circular unit referenc','e between $1 and $2'#000+
   '10021_F_Can'#039't compile unit $1, no sources available'#000+
   '10021_F_Can'#039't compile unit $1, no sources available'#000+
   '10022_F_Can'#039't find unit $1 used by $2'#000+
   '10022_F_Can'#039't find unit $1 used by $2'#000+
-  '1002','3_W_Unit $1 was not found but $2 exists'#000+
+  '10023_W_Unit $1 was not found but $2 exists'#000+
   '10024_F_Unit $1 searched but $2 found'#000+
   '10024_F_Unit $1 searched but $2 found'#000+
-  '10025_W_Compiling the system unit requires the -Us switch'#000+
+  '10025_W_Compiling the system unit requires the -','Us switch'#000+
   '10026_F_There were $1 errors compiling module, stopping'#000+
   '10026_F_There were $1 errors compiling module, stopping'#000+
   '10027_U_Load from $1 ($2) unit $3'#000+
   '10027_U_Load from $1 ($2) unit $3'#000+
-  '10028_U_Recomp','iling $1, checksum changed for $2'#000+
+  '10028_U_Recompiling $1, checksum changed for $2'#000+
   '10029_U_Recompiling $1, source found only'#000+
   '10029_U_Recompiling $1, source found only'#000+
-  '10030_U_Recompiling unit, static lib is older than ppufile'#000+
+  '10030_U_Recompiling unit, static lib is older than',' ppufile'#000+
   '10031_U_Recompiling unit, shared lib is older than ppufile'#000+
   '10031_U_Recompiling unit, shared lib is older than ppufile'#000+
-  '10032_U_Recompiling unit, obj and asm are olde','r than ppufile'#000+
+  '10032_U_Recompiling unit, obj and asm are older than ppufile'#000+
   '10033_U_Recompiling unit, obj is older than asm'#000+
   '10033_U_Recompiling unit, obj is older than asm'#000+
   '10034_U_Parsing interface of $1'#000+
   '10034_U_Parsing interface of $1'#000+
-  '10035_U_Parsing implementation of $1'#000+
+  '10035_U_Parsing implementation ','of $1'#000+
   '10036_U_Second load for unit $1'#000+
   '10036_U_Second load for unit $1'#000+
   '10037_U_PPU Check file $1 time $2'#000+
   '10037_U_PPU Check file $1 time $2'#000+
-  '10040_W_Can'#039't recompile unit $1, but found',' modifed include files'+
-  #000+
+  '10040_W_Can'#039't recompile unit $1, but found modifed include files'#000+
   '10041_U_File $1 is newer than the one used for creating PPU file $2'#000+
   '10041_U_File $1 is newer than the one used for creating PPU file $2'#000+
-  '10042_U_Trying to use a unit which was compiled with a different FPU m'+
-  'ode'#000+
+  '10042_U_Trying to use a unit which ','was compiled with a different FPU'+
+  ' mode'#000+
   '10043_U_Loading interface units from $1'#000+
   '10043_U_Loading interface units from $1'#000+
-  '10044_U_Loading implementation unit','s from $1'#000+
+  '10044_U_Loading implementation units from $1'#000+
   '10045_U_Interface CRC changed for unit $1'#000+
   '10045_U_Interface CRC changed for unit $1'#000+
   '10046_U_Implementation CRC changed for unit $1'#000+
   '10046_U_Implementation CRC changed for unit $1'#000+
-  '10047_U_Finished compiling unit $1'#000+
+  '10047_U_Finished compiling ','unit $1'#000+
   '10048_U_Adding dependency: $1 depends on $2'#000+
   '10048_U_Adding dependency: $1 depends on $2'#000+
   '10049_U_No reload, is caller: $1'#000+
   '10049_U_No reload, is caller: $1'#000+
-  '10050_U_No reload, already in',' second compile: $1'#000+
+  '10050_U_No reload, already in second compile: $1'#000+
   '10051_U_Flag for reload: $1'#000+
   '10051_U_Flag for reload: $1'#000+
   '10052_U_Forced reloading'#000+
   '10052_U_Forced reloading'#000+
   '10053_U_Previous state of $1: $2'#000+
   '10053_U_Previous state of $1: $2'#000+
-  '10054_U_Already compiling $1, setting second compile'#000+
+  '10054_U_Already comp','iling $1, setting second compile'#000+
   '10055_U_Loading unit $1'#000+
   '10055_U_Loading unit $1'#000+
   '10056_U_Finished loading unit $1'#000+
   '10056_U_Finished loading unit $1'#000+
-  '10057_U_Registering new ','unit $1'#000+
+  '10057_U_Registering new unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
   '10059_U_Skipping re-resolving unit $1, still loading used units'#000+
   '10059_U_Skipping re-resolving unit $1, still loading used units'#000+
-  '10060_U_Unloading resource unit $1 (not needed)'#000+
+  '10060_U_Unloading resourc','e unit $1 (not needed)'#000+
   '10061_E_Unit $1 was compiled using a different whole program optimizat'+
   '10061_E_Unit $1 was compiled using a different whole program optimizat'+
-  'ion feedback input ($','2, $3); recompile it without wpo or use the sam'+
-  'e wpo feedback input file for this compilation invocation'#000+
-  '10062_U_Indirect interface (objects/classes) CRC changed for unit $1'#000+
+  'ion feedback input ($2, $3); recompile it without wpo or use the same '+
+  'wpo feedback input file for this compilation invocation'#000+
+  '10062_U_Indirect inte','rface (objects/classes) CRC changed for unit $1'+
+  #000+
   '11000_O_$1 [options] <inputfile> [options]'#000+
   '11000_O_$1 [options] <inputfile> [options]'#000+
-  '11001_W_Only one source',' file supported, changing source file to comp'+
-  'ile from "$1" into "$2"'#000+
+  '11001_W_Only one source file supported, changing source file to compil'+
+  'e from "$1" into "$2"'#000+
   '11002_W_DEF file can be created only for OS/2'#000+
   '11002_W_DEF file can be created only for OS/2'#000+
-  '11003_E_nested response files are not supported'#000+
+  '11003_E_nes','ted response files are not supported'#000+
   '11004_F_No source file name in command line'#000+
   '11004_F_No source file name in command line'#000+
-  '11005_N_No option inside $1 confi','g file'#000+
+  '11005_N_No option inside $1 config file'#000+
   '11006_E_Illegal parameter: $1'#000+
   '11006_E_Illegal parameter: $1'#000+
   '11007_H_-? writes help pages'#000+
   '11007_H_-? writes help pages'#000+
   '11008_F_Too many config files nested'#000+
   '11008_F_Too many config files nested'#000+
-  '11009_F_Unable to open file $1'#000+
+  '11009_F_Unable to open ','file $1'#000+
   '11010_D_Reading further options from $1'#000+
   '11010_D_Reading further options from $1'#000+
   '11011_W_Target is already set to: $1'#000+
   '11011_W_Target is already set to: $1'#000+
-  '11012_W_Shared libs not suppo','rted on DOS platform, reverting to stat'+
-  'ic'#000+
+  '11012_W_Shared libs not supported on DOS platform, reverting to static'+
+  #000+
   '11013_F_In options file $1 at line $2 too many \var{\#IF(N)DEFs} encou'+
   '11013_F_In options file $1 at line $2 too many \var{\#IF(N)DEFs} encou'+
   'ntered'#000+
   'ntered'#000+
-  '11014_F_In options file $1 at line $2 unexpected \var{\#ENDIFs} encoun'+
-  'tered'#000+
-  '11015_F_Open conditional at the end of the op','tions file'#000+
+  '11014_F','_In options file $1 at line $2 unexpected \var{\#ENDIFs} enco'+
+  'untered'#000+
+  '11015_F_Open conditional at the end of the options file'#000+
   '11016_W_Debug information generation is not supported by this executab'+
   '11016_W_Debug information generation is not supported by this executab'+
   'le'#000+
   'le'#000+
   '11017_H_Try recompiling with -dGDB'#000+
   '11017_H_Try recompiling with -dGDB'#000+
-  '11018_W_You are using the obsolete switch $1'#000+
+  '11018_W','_You are using the obsolete switch $1'#000+
   '11019_W_You are using the obsolete switch $1, please use $2'#000+
   '11019_W_You are using the obsolete switch $1, please use $2'#000+
-  '11020_N_Switchin','g assembler to default source writing assembler'#000+
+  '11020_N_Switching assembler to default source writing assembler'#000+
   '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
   '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
-  '11022_W_"$1" assembler use forced'#000+
+  '11022_W_"$1','" assembler use forced'#000+
   '11026_T_Reading options from file $1'#000+
   '11026_T_Reading options from file $1'#000+
   '11027_T_Reading options from environment $1'#000+
   '11027_T_Reading options from environment $1'#000+
-  '11028_D_Ha','ndling option "$1"'#000+
+  '11028_D_Handling option "$1"'#000+
   '11029_O_*** press enter ***'#000+
   '11029_O_*** press enter ***'#000+
   '11030_H_Start of reading config file $1'#000+
   '11030_H_Start of reading config file $1'#000+
   '11031_H_End of reading config file $1'#000+
   '11031_H_End of reading config file $1'#000+
-  '11032_D_interpreting option "$1"'#000+
+  '1','1032_D_interpreting option "$1"'#000+
   '11036_D_interpreting firstpass option "$1"'#000+
   '11036_D_interpreting firstpass option "$1"'#000+
   '11033_D_interpreting file option "$1"'#000+
   '11033_D_interpreting file option "$1"'#000+
-  '1','1034_D_Reading config file "$1"'#000+
+  '11034_D_Reading config file "$1"'#000+
   '11035_D_found source file name "$1"'#000+
   '11035_D_found source file name "$1"'#000+
-  '11039_E_Unknown code page'#000+
-  '11040_F_Config file $1 is a directory'#000+
+  '11039_E_Unknown codepage'#000+
+  '11040_F_Config file $1 is a direc','tory'#000+
   '11041_W_Assembler output selected "$1" cannot generate debug info, deb'+
   '11041_W_Assembler output selected "$1" cannot generate debug info, deb'+
   'ugging disabled'#000+
   'ugging disabled'#000+
-  '11042_W_Use of ppc386.','cfg is deprecated, please use fpc.cfg instead'#000+
+  '11042_W_Use of ppc386.cfg is deprecated, please use fpc.cfg instead'#000+
   '11043_F_In options file $1 at line $2 \var{\#ELSE} directive without \'+
   '11043_F_In options file $1 at line $2 \var{\#ELSE} directive without \'+
-  'var{\#IF(N)DEF} found'#000+
+  'var{\#IF(N)','DEF} found'#000+
   '11044_F_Option "$1" is not, or not yet, supported on the current targe'+
   '11044_F_Option "$1" is not, or not yet, supported on the current targe'+
   't platform'#000+
   't platform'#000+
-  '11045_F_The feature "','$1" is not, or not yet, supported on the select'+
-  'ed target platform'#000+
-  '11046_N_DWARF debug information cannot be used with smart linking on t'+
-  'his target, switching to static linking'#000+
-  '11047_W_Option "$1" is ignored for the current target platform.'#000,
+  '11045_F_The feature "$1" is not, or not yet, supported on the selected'+
+  ' target platform'#000+
+  '11046_N_DWARF debug information cannot be used with smart lin','king on'+
+  ' this target, switching to static linking'#000+
+  '11047_W_Option "$1" is ignored for the current target platform.'#000+
   '11048_W_Disabling external debug information because it is unsupported'+
   '11048_W_Disabling external debug information because it is unsupported'+
   ' for the selected target/debug format combination.'#000+
   ' for the selected target/debug format combination.'#000+
-  '11049_N_DWARF debug information cannot be used with smart linking with'+
-  ' external assembler, disabling static library cre','ation.  '#000+
+  '11049_','N_DWARF debug information cannot be used with smart linking wi'+
+  'th external assembler, disabling static library creation.'#000+
   '12000_F_Cannot open whole program optimization feedback file "$1"'#000+
   '12000_F_Cannot open whole program optimization feedback file "$1"'#000+
-  '12001_D_Processing whole program optimization information in wpo feedb'+
-  'ack file "$1"'#000+
+  '12001_D_Processing whole program optimization informat','ion in wpo fee'+
+  'dback file "$1"'#000+
   '12002_D_Finished processing the whole program optimization information'+
   '12002_D_Finished processing the whole program optimization information'+
-  ' in wpo fee','dback file "$1"'#000+
+  ' in wpo feedback file "$1"'#000+
   '12003_E_Expected section header, but got "$2" at line $1 of wpo feedba'+
   '12003_E_Expected section header, but got "$2" at line $1 of wpo feedba'+
   'ck file'#000+
   'ck file'#000+
-  '12004_W_No handler registered for whole program optimization section "'+
-  '$2" at line $1 of wpo feedback file, ignoring'#000+
-  '12005_D_Found whole program op','timization section "$1" with informati'+
-  'on about "$2"'#000+
+  '12004_W_No handler registered for w','hole program optimization section'+
+  ' "$2" at line $1 of wpo feedback file, ignoring'#000+
+  '12005_D_Found whole program optimization section "$1" with information'+
+  ' about "$2"'#000+
   '12006_F_The selected whole program optimizations require a previously '+
   '12006_F_The selected whole program optimizations require a previously '+
-  'generated feedback file (use -Fw to specify)'#000+
+  'generat','ed feedback file (use -Fw to specify)'#000+
   '12007_E_No collected information necessary to perform "$1" whole progr'+
   '12007_E_No collected information necessary to perform "$1" whole progr'+
-  'am ','optimization found'#000+
+  'am optimization found'#000+
   '12008_F_Specify a whole program optimization feedback file to store th'+
   '12008_F_Specify a whole program optimization feedback file to store th'+
   'e generated info in (using -FW)'#000+
   'e generated info in (using -FW)'#000+
-  '12009_E_Not generating any whole program optimization information, yet'+
-  ' a feedback file was specified (using -FW)'#000+
-  '12010_','E_Not performing any whole program optimizations, yet an input'+
-  ' feedback file was specified (using -Fw)'#000+
-  '12011_D_Skipping whole program optimization section "$1", because not '+
-  'needed by the requested optimizations'#000+
-  '12012_W_Overriding previously',' read information for "$1" from feedbac'+
-  'k input file using information in section "$2"'#000+
-  '12013_E_Cannot extract symbol liveness information from program when s'+
-  'tripping symbols, use -Xs-'#000+
-  '12014_E_Cannot extract symbol liveness information from p','rogram when'+
-  ' when not linking'#000+
+  '12009_E_','Not generating any whole program optimization information, y'+
+  'et a feedback file was specified (using -FW)'#000+
+  '12010_E_Not performing any whole program optimizations, yet an input f'+
+  'eedback file was specified (using -Fw)'#000+
+  '12011_D_Skipping whole pro','gram optimization section "$1", because no'+
+  't needed by the requested optimizations'#000+
+  '12012_W_Overriding previously read information for "$1" from feedback '+
+  'input file using information in section "$2"'#000+
+  '12013_E_Cannot extract symbol liveness info','rmation from program when'+
+  ' stripping symbols, use -Xs-'#000+
+  '12014_E_Cannot extract symbol liveness information from program when w'+
+  'hen not linking'#000+
   '12015_F_Cannot find "$1" or "$2" to extract symbol liveness informatio'+
   '12015_F_Cannot find "$1" or "$2" to extract symbol liveness informatio'+
   'n from linked program'#000+
   'n from linked program'#000+
-  '12016_E_Error during reading symbol liveness information produced by "'+
-  '$1"'#000+
-  '12017_F_Error executing "$1" (exitcode: $2) t','o extract symbol inform'+
-  'ation from linked program'#000+
+  '12016_E_','Error during reading symbol liveness information produced by'+
+  ' "$1"'#000+
+  '12017_F_Error executing "$1" (exitcode: $2) to extract symbol informat'+
+  'ion from linked program'#000+
   '12018_E_Collection of symbol liveness information can only help when u'+
   '12018_E_Collection of symbol liveness information can only help when u'+
-  'sing smart linking, use -CX -XX'#000+
+  'sing smart',' linking, use -CX -XX'#000+
   '12019_E_Cannot create specified whole program optimisation feedback fi'+
   '12019_E_Cannot create specified whole program optimisation feedback fi'+
   'le "$1"'#000+
   'le "$1"'#000+
-  '11023_Free ','Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $F'+
-  'PCCPU'#010+
+  '11023_Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPC'+
+  'CPU'#010+
   'Copyright (c) 1993-2011 by Florian Klaempfl and others'#000+
   'Copyright (c) 1993-2011 by Florian Klaempfl and others'#000+
-  '11024_Free Pascal Compiler version $FPCVERSION'#010+
+  '11024_Free ','Pascal Compiler version $FPCVERSION'#010+
   #010+
   #010+
   'Compiler Date      : $FPCDATE'#010+
   'Compiler Date      : $FPCDATE'#010+
   'Compiler CPU Target: $FPCCPU'#010+
   'Compiler CPU Target: $FPCCPU'#010+
   #010+
   #010+
-  'Supported targ','ets:'#010+
+  'Supported targets:'#010+
   '  $OSTARGETS'#010+
   '  $OSTARGETS'#010+
   #010+
   #010+
   'Supported CPU instruction sets:'#010+
   'Supported CPU instruction sets:'#010+
@@ -1091,339 +1112,339 @@ const msgtxt : array[0..000255,1..240] of char=(
   'Supported FPU instruction sets:'#010+
   'Supported FPU instruction sets:'#010+
   '  $FPUINSTRUCTIONSETS'#010+
   '  $FPUINSTRUCTIONSETS'#010+
   #010+
   #010+
-  'Supported ABI targets:'#010+
+  'Sup','ported ABI targets:'#010+
   '  $ABITARGETS'#010+
   '  $ABITARGETS'#010+
   #010+
   #010+
   'Supported Optimizations:'#010+
   'Supported Optimizations:'#010+
   '  $OPTIMIZATIONS'#010+
   '  $OPTIMIZATIONS'#010+
   #010+
   #010+
-  'Supported Whole Program Optimizat','ions:'#010+
+  'Supported Whole Program Optimizations:'#010+
   '  All'#010+
   '  All'#010+
   '  $WPOPTIMIZATIONS'#010+
   '  $WPOPTIMIZATIONS'#010+
   #010+
   #010+
   'Supported Microcontroller types:'#010+
   'Supported Microcontroller types:'#010+
   '  $CONTROLLERTYPES'#010+
   '  $CONTROLLERTYPES'#010+
   #010+
   #010+
-  'This program comes under the GNU General Public Licence'#010+
+  'This program comes under the GNU General Pub','lic Licence'#010+
   'For more information read COPYING.FPC'#010+
   'For more information read COPYING.FPC'#010+
   #010+
   #010+
   'Report bugs, suggestions, etc. to:'#010+
   'Report bugs, suggestions, etc. to:'#010+
-  '                 http://b','ugs.freepascal.org'#010+
+  '                 http://bugs.freepascal.org'#010+
   'or'#010+
   'or'#010+
   '                 [email protected]'#000+
   '                 [email protected]'#000+
-  '11025_**0*_Put + after a boolean switch option to enable it, - to disa'+
+  '11025_**0*_Put + after a boolean switch option to enable it, - to disa',
   'ble it'#010+
   'ble it'#010+
   '**1a_The compiler doesn'#039't delete the generated assembler file'#010+
   '**1a_The compiler doesn'#039't delete the generated assembler file'#010+
-  '**2al_List sourcecode lines in assembler f','ile'#010+
+  '**2al_List sourcecode lines in assembler file'#010+
   '**2an_List node info in assembler file'#010+
   '**2an_List node info in assembler file'#010+
   '*L2ap_Use pipes instead of creating temporary assembler files'#010+
   '*L2ap_Use pipes instead of creating temporary assembler files'#010+
-  '**2ar_List register allocation/release info in assembler file'#010+
+  '**2ar_List register allo','cation/release info in assembler file'#010+
   '**2at_List temp allocation/release info in assembler file'#010+
   '**2at_List temp allocation/release info in assembler file'#010+
-  '**1A<x>_Output ','format:'#010+
+  '**1A<x>_Output format:'#010+
   '**2Adefault_Use default assembler'#010+
   '**2Adefault_Use default assembler'#010+
   '3*2Aas_Assemble using GNU AS'#010+
   '3*2Aas_Assemble using GNU AS'#010+
-  '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using internal writer'#010+
+  '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using internal wri','ter'#010+
   '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+
   '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+
   '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010+
   '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010+
-  '3*2Anasmwin32_Win32 ob','ject file using Nasm'#010+
+  '3*2Anasmwin32_Win32 object file using Nasm'#010+
   '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
   '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
   '3*2Awasm_Obj file using Wasm (Watcom)'#010+
   '3*2Awasm_Obj file using Wasm (Watcom)'#010+
-  '3*2Anasmobj_Obj file using Nasm'#010+
+  '3*2Anasmobj_Obj file ','using Nasm'#010+
   '3*2Amasm_Obj file using Masm (Microsoft)'#010+
   '3*2Amasm_Obj file using Masm (Microsoft)'#010+
   '3*2Atasm_Obj file using Tasm (Borland)'#010+
   '3*2Atasm_Obj file using Tasm (Borland)'#010+
-  '3*2Aelf_ELF (Linux) ','using internal writer'#010+
+  '3*2Aelf_ELF (Linux) using internal writer'#010+
   '3*2Acoff_COFF (Go32v2) using internal writer'#010+
   '3*2Acoff_COFF (Go32v2) using internal writer'#010+
   '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+
   '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+
-  '4*2Aas_Assemble using GNU AS'#010+
+  '4*2Aas_Assemb','le using GNU AS'#010+
   '4*2Agas_Assemble using GNU GAS'#010+
   '4*2Agas_Assemble using GNU GAS'#010+
   '4*2Agas-darwin_Assemble darwin Mach-O64 using GNU GAS'#010+
   '4*2Agas-darwin_Assemble darwin Mach-O64 using GNU GAS'#010+
-  '4*2Amasm_W','in64 object file using ml64 (Microsoft)'#010+
+  '4*2Amasm_Win64 object file using ml64 (Microsoft)'#010+
   '4*2Apecoff_PE-COFF (Win64) using internal writer'#010+
   '4*2Apecoff_PE-COFF (Win64) using internal writer'#010+
-  '4*2Aelf_ELF (Linux-64bit) using internal writer'#010+
+  '4*2Aelf_ELF (Linux-64bit) using internal',' writer'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Agas_GNU Motorola assembler'#010+
   '6*2Agas_GNU Motorola assembler'#010+
   '6*2Amit_MIT Syntax (old GAS)'#010+
   '6*2Amit_MIT Syntax (old GAS)'#010+
-  '6*2Amot_Sta','ndard Motorola assembler'#010+
+  '6*2Amot_Standard Motorola assembler'#010+
   'A*2Aas_Assemble using GNU AS'#010+
   'A*2Aas_Assemble using GNU AS'#010+
   'P*2Aas_Assemble using GNU AS'#010+
   'P*2Aas_Assemble using GNU AS'#010+
   'S*2Aas_Assemble using GNU AS'#010+
   'S*2Aas_Assemble using GNU AS'#010+
-  '**1b_Generate browser info'#010+
+  '**1b_Generate bro','wser info'#010+
   '**2bl_Generate local symbol info'#010+
   '**2bl_Generate local symbol info'#010+
   '**1B_Build all modules'#010+
   '**1B_Build all modules'#010+
   '**1C<x>_Code generation options:'#010+
   '**1C<x>_Code generation options:'#010+
-  '**2C3<x>_Tur','n on ieee error checking for constants'#010+
+  '**2C3<x>_Turn on ieee error checking for constants'#010+
   '**2Ca<x>_Select ABI, see fpc -i for possible values'#010+
   '**2Ca<x>_Select ABI, see fpc -i for possible values'#010+
   '**2Cb_Generate big-endian code'#010+
   '**2Cb_Generate big-endian code'#010+
-  '**2Cc<x>_Set default calling convention to <x>'#010+
+  '**2Cc<x','>_Set default calling convention to <x>'#010+
   '**2CD_Create also dynamic library (not supported)'#010+
   '**2CD_Create also dynamic library (not supported)'#010+
-  '**2Ce_Compilation wit','h emulated floating point opcodes'#010+
+  '**2Ce_Compilation with emulated floating point opcodes'#010+
   '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
   '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
   'lues'#010+
   'lues'#010+
-  '**2CF<x>_Minimal floating point constant precision (default, 32, 64)'#010+
+  '**2CF<x>_Minimal flo','ating point constant precision (default, 32, 64)'+
+  #010+
   '**2Cg_Generate PIC code'#010+
   '**2Cg_Generate PIC code'#010+
-  '**2Ch<n>_<n> bytes heap (between 1023 ','and 67107840)'#010+
+  '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
   '**2Ci_IO-checking'#010+
   '**2Ci_IO-checking'#010+
   '**2Cn_Omit linking stage'#010+
   '**2Cn_Omit linking stage'#010+
   '**2Co_Check overflow of integer operations'#010+
   '**2Co_Check overflow of integer operations'#010+
-  '**2CO_Check for possible overflow of integer operations'#010+
+  '**2CO_Check for possible over','flow of integer operations'#010+
   '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+
   '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+
-  '**2CP<x>=<y>_ packin','g settings'#010+
+  '**2CP<x>=<y>_ packing settings'#010+
   '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+
   '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+
   'and 8'#010+
   'and 8'#010+
   '**2Cr_Range checking'#010+
   '**2Cr_Range checking'#010+
-  '**2CR_Verify object method call validity'#010+
+  '**2CR_Verify object m','ethod call validity'#010+
   '**2Cs<n>_Set stack checking size to <n>'#010+
   '**2Cs<n>_Set stack checking size to <n>'#010+
-  '**2Ct_Stack checking (for testing only, see manual)',#010+
+  '**2Ct_Stack checking (for testing only, see manual)'#010+
   '**2CX_Create also smartlinked library'#010+
   '**2CX_Create also smartlinked library'#010+
   '**1d<x>_Defines the symbol <x>'#010+
   '**1d<x>_Defines the symbol <x>'#010+
   '**1D_Generate a DEF file'#010+
   '**1D_Generate a DEF file'#010+
   '**2Dd<x>_Set description to <x>'#010+
   '**2Dd<x>_Set description to <x>'#010+
-  '**2Dv<x>_Set DLL version to <x>'#010+
+  '**','2Dv<x>_Set DLL version to <x>'#010+
   '*O2Dw_PM application'#010+
   '*O2Dw_PM application'#010+
   '**1e<x>_Set path to executable'#010+
   '**1e<x>_Set path to executable'#010+
   '**1E_Same as -Cn'#010+
   '**1E_Same as -Cn'#010+
-  '**1fPIC_Same',' as -Cg'#010+
+  '**1fPIC_Same as -Cg'#010+
   '**1F<x>_Set file names and paths:'#010+
   '**1F<x>_Set file names and paths:'#010+
   '**2Fa<x>[,y]_(for a program) load units <x> and [y] before uses is par'+
   '**2Fa<x>[,y]_(for a program) load units <x> and [y] before uses is par'+
   'sed'#010+
   'sed'#010+
-  '**2Fc<x>_Set input codepage to <x>'#010+
+  '**2Fc<x>_Set ','input codepage to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
-  '**2Fd_Disable the compiler'#039's internal directo','ry cache'#010+
+  '**2Fd_Disable the compiler'#039's internal directory cache'#010+
   '**2FD<x>_Set the directory where to search for compiler utilities'#010+
   '**2FD<x>_Set the directory where to search for compiler utilities'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
-  '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+
+  '**2Ff<x>_Add <x>',' to framework path (Darwin only)'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
   '**2Fi<x>_Add <x> to include path'#010+
   '**2Fi<x>_Add <x> to include path'#010+
-  '**2F','l<x>_Add <x> to library path'#010+
+  '**2Fl<x>_Add <x> to library path'#010+
   '**2FL<x>_Use <x> as dynamic linker'#010+
   '**2FL<x>_Use <x> as dynamic linker'#010+
-  '**2Fm<x>_Load unicode conversion table from <x>.txt in the compiler di'+
-  'r'#010+
+  '**2Fm<x>_Load unicode conversion table from <x>.txt in the compil','er '+
+  'dir'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fr<x>_Load error message file <x>'#010+
   '**2Fr<x>_Load error message file <x>'#010+
-  '**2FR<x>_Set resource (.res) linker',' to <x>'#010+
+  '**2FR<x>_Set resource (.res) linker to <x>'#010+
   '**2Fu<x>_Add <x> to unit path'#010+
   '**2Fu<x>_Add <x> to unit path'#010+
   '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+
   '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+
-  '**2FW<x>_Store generated whole-program optimization feedback in <x>'#010+
+  '**2FW<x>_Store generated whole-program ','optimization feedback in <x>'#010+
   '**2Fw<x>_Load previously stored whole-program optimization feedback fr'+
   '**2Fw<x>_Load previously stored whole-program optimization feedback fr'+
   'om <x>'#010+
   'om <x>'#010+
-  '*g1g_','Generate debug information (default format for target)'#010+
+  '*g1g_Generate debug information (default format for target)'#010+
   '*g2gc_Generate checks for pointers'#010+
   '*g2gc_Generate checks for pointers'#010+
-  '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
+  '*g2gh_Use heaptrace unit (for memory le','ak/corruption debugging)'#010+
   '*g2gl_Use line info unit (show more info with backtraces)'#010+
   '*g2gl_Use line info unit (show more info with backtraces)'#010+
-  '*g2go<x>_Set debug informati','on options'#010+
+  '*g2go<x>_Set debug information options'#010+
   '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre'+
   '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre'+
   'aks gdb < 6.5)'#010+
   'aks gdb < 6.5)'#010+
-  '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+
-  #010+
+  '*g3gostabsabsincludes_ Store absolute/ful','l include file paths in Sta'+
+  'bs'#010+
   '*g3godwarfmethodclassprefix_ Prefix method names in DWARF with class n'+
   '*g3godwarfmethodclassprefix_ Prefix method names in DWARF with class n'+
   'ame'#010+
   'ame'#010+
-  '*g2gp_P','reserve case in stabs symbol names'#010+
+  '*g2gp_Preserve case in stabs symbol names'#010+
   '*g2gs_Generate Stabs debug information'#010+
   '*g2gs_Generate Stabs debug information'#010+
-  '*g2gt_Trash local variables (to detect uninitialized uses)'#010+
+  '*g2gt_Trash local variables (to detect uninitialized us','es)'#010+
   '*g2gv_Generates programs traceable with Valgrind'#010+
   '*g2gv_Generates programs traceable with Valgrind'#010+
   '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+
   '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+
-  '*g','2gw2_Generate DWARFv2 debug information'#010+
+  '*g2gw2_Generate DWARFv2 debug information'#010+
   '*g2gw3_Generate DWARFv3 debug information'#010+
   '*g2gw3_Generate DWARFv3 debug information'#010+
-  '*g2gw4_Generate DWARFv4 debug information (experimental)'#010+
+  '*g2gw4_Generate DWARFv4 debug information (expe','rimental)'#010+
   '**1i_Information'#010+
   '**1i_Information'#010+
   '**2iD_Return compiler date'#010+
   '**2iD_Return compiler date'#010+
   '**2iV_Return short compiler version'#010+
   '**2iV_Return short compiler version'#010+
-  '**2iW_Return full com','piler version'#010+
+  '**2iW_Return full compiler version'#010+
   '**2iSO_Return compiler OS'#010+
   '**2iSO_Return compiler OS'#010+
   '**2iSP_Return compiler host processor'#010+
   '**2iSP_Return compiler host processor'#010+
   '**2iTO_Return target OS'#010+
   '**2iTO_Return target OS'#010+
-  '**2iTP_Return target processor'#010+
+  '**2iTP_Return target proces','sor'#010+
   '**1I<x>_Add <x> to include path'#010+
   '**1I<x>_Add <x> to include path'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1l_Write logo'#010+
   '**1l_Write logo'#010+
-  '**1M<x>_Set language mode to',' <x>'#010+
+  '**1M<x>_Set language mode to <x>'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mobjfpc_FPC mode with Object Pascal support'#010+
   '**2Mobjfpc_FPC mode with Object Pascal support'#010+
-  '**2Mdelphi_Delphi 7 compatibility mode'#010+
+  '**2Mdelphi_Delphi 7 compatibility mode'#010,
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
   '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+
   '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+
-  '**1n_Do not read th','e default config files'#010+
+  '**1n_Do not read the default config files'#010+
   '**1N<x>_Node tree optimizations'#010+
   '**1N<x>_Node tree optimizations'#010+
   '**2Nu_Unroll loops'#010+
   '**2Nu_Unroll loops'#010+
-  '**1o<x>_Change the name of the executable produced to <x>'#010+
+  '**1o<x>_Change the name of the executable produced to <','x>'#010+
   '**1O<x>_Optimizations:'#010+
   '**1O<x>_Optimizations:'#010+
   '**2O-_Disable optimizations'#010+
   '**2O-_Disable optimizations'#010+
-  '**2O1_Level 1 optimizations (quick and debugger friendly)',#010+
+  '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+
   '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
   '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
-  '**2Oa<x>=<y>_Set alignment'#010+
+  '**2Oa<x>=<y>_Set ','alignment'#010+
   '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+
   '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+
   'values'#010+
   'values'#010+
-  '**2Op<x>_Set target cpu ','for optimizing, see fpc -i for possible valu'+
-  'es'#010+
+  '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible values'+
+  #010+
   '**2OW<x>_Generate whole-program optimization feedback for optimization'+
   '**2OW<x>_Generate whole-program optimization feedback for optimization'+
-  ' <x>, see fpc -i for possible values'#010+
+  ' <x>, see fp','c -i for possible values'#010+
   '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for possib'+
   '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for possib'+
   'le values'#010+
   'le values'#010+
-  '**2Os_','Optimize for size rather than speed'#010+
+  '**2Os_Optimize for size rather than speed'#010+
   '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
   '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
-  '**1R<x>_Assembler reading style:'#010+
+  '**1R<x>_Assembler reading style:'#010,
   '**2Rdefault_Use default assembler for target'#010+
   '**2Rdefault_Use default assembler for target'#010+
   '3*2Ratt_Read AT&T style assembler'#010+
   '3*2Ratt_Read AT&T style assembler'#010+
-  '3*2Rintel_Read Intel style assem','bler'#010+
+  '3*2Rintel_Read Intel style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
   '**1S<x>_Syntax options:'#010+
   '**1S<x>_Syntax options:'#010+
   '**2S2_Same as -Mobjfpc'#010+
   '**2S2_Same as -Mobjfpc'#010+
-  '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+
+  '**2Sc_Support operators like C (*=,+=,/','= and -=)'#010+
   '**2Sa_Turn on assertions'#010+
   '**2Sa_Turn on assertions'#010+
   '**2Sd_Same as -Mdelphi'#010+
   '**2Sd_Same as -Mdelphi'#010+
-  '**2Se<x>_Error options. <x> is a combination of the f','ollowing:'#010+
+  '**2Se<x>_Error options. <x> is a combination of the following:'#010+
   '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+
   '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+
   '**3*_w : Compiler also halts after warnings'#010+
   '**3*_w : Compiler also halts after warnings'#010+
-  '**3*_n : Compiler also halts after notes'#010+
+  '**3*_n : Comp','iler also halts after notes'#010+
   '**3*_h : Compiler also halts after hints'#010+
   '**3*_h : Compiler also halts after hints'#010+
-  '**2Sg_Enable LABEL and GOTO (default in -M','tp and -Mdelphi)'#010+
+  '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
   '**2Sh_Use ansistrings by default instead of shortstrings'#010+
   '**2Sh_Use ansistrings by default instead of shortstrings'#010+
-  '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+
+  '**2Si_Turn on inlining of procedures/functions declared',' as "inline"'#010+
   '**2Sk_Load fpcylix unit'#010+
   '**2Sk_Load fpcylix unit'#010+
   '**2SI<x>_Set interface style to <x>'#010+
   '**2SI<x>_Set interface style to <x>'#010+
-  '**3SIcom_COM compatible interface (def','ault)'#010+
+  '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**2Sm_Support macros like C (global)'#010+
   '**2Sm_Support macros like C (global)'#010+
   '**2So_Same as -Mtp'#010+
   '**2So_Same as -Mtp'#010+
-  '**2Ss_Constructor name must be init (destructor must be done)'#010+
+  '**2Ss_Constructor name must b','e init (destructor must be done)'#010+
   '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+
   '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+
-  '**2Sy_@<point','er> returns a typed pointer, same as $T+'#010+
+  '**2Sy_@<pointer> returns a typed pointer, same as $T+'#010+
   '**1s_Do not call assembler and linker'#010+
   '**1s_Do not call assembler and linker'#010+
   '**2sh_Generate script to link on host'#010+
   '**2sh_Generate script to link on host'#010+
-  '**2st_Generate script to link on target'#010+
+  '**2st_Genera','te script to link on target'#010+
   '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**2sr_Skip register allocation phase (use with -alr)'#010+
-  '**1T<x>_Target operating syste','m:'#010+
+  '**1T<x>_Target operating system:'#010+
   '3*2Tdarwin_Darwin/Mac OS X'#010+
   '3*2Tdarwin_Darwin/Mac OS X'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Tfreebsd_FreeBSD'#010+
   '3*2Tfreebsd_FreeBSD'#010+
-  '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
+  '3*2Tgo32v2_Version 2 of DJ De','lorie DOS extender'#010+
   '3*2Tiphonesim_ iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tda'+
   '3*2Tiphonesim_ iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tda'+
   'rwin)'#010+
   'rwin)'#010+
-  '3*2Tlinux_Linux'#010,
+  '3*2Tlinux_Linux'#010+
   '3*2Tnetbsd_NetBSD'#010+
   '3*2Tnetbsd_NetBSD'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
   '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
   '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Topenbsd_OpenBSD'#010+
-  '3*2Tos2_OS/2 / eComStation'#010+
+  '3*2Tos2_','OS/2 / eComStation'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsymbian_Symbian OS'#010+
   '3*2Tsymbian_Symbian OS'#010+
   '3*2Tsolaris_Solaris'#010+
   '3*2Tsolaris_Solaris'#010+
-  '3*2Twatcom_Watcom compati','ble DOS extender'#010+
+  '3*2Twatcom_Watcom compatible DOS extender'#010+
   '3*2Twdosx_WDOSX DOS extender'#010+
   '3*2Twdosx_WDOSX DOS extender'#010+
   '3*2Twin32_Windows 32 Bit'#010+
   '3*2Twin32_Windows 32 Bit'#010+
   '3*2Twince_Windows CE'#010+
   '3*2Twince_Windows CE'#010+
   '4*2Tdarwin_Darwin/Mac OS X'#010+
   '4*2Tdarwin_Darwin/Mac OS X'#010+
-  '4*2Tlinux_Linux'#010+
+  '4*2Tlinux_','Linux'#010+
   '4*2Twin64_Win64 (64 bit Windows systems)'#010+
   '4*2Twin64_Win64 (64 bit Windows systems)'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
-  '6*2Tlinux_Li','nux'#010+
+  '6*2Tlinux_Linux'#010+
   '6*2Tpalmos_PalmOS'#010+
   '6*2Tpalmos_PalmOS'#010+
   'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+
   'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Twince_Windows CE'#010+
   'A*2Twince_Windows CE'#010+
   'P*2Tamiga_AmigaOS'#010+
   'P*2Tamiga_AmigaOS'#010+
-  'P*2Tdarwin_Darwin/Mac OS X'#010+
+  'P*2Tdarwin_Darwin/Mac',' OS X'#010+
   'P*2Tlinux_Linux'#010+
   'P*2Tlinux_Linux'#010+
   'P*2Tmacos_Mac OS (classic)'#010+
   'P*2Tmacos_Mac OS (classic)'#010+
   'P*2Tmorphos_MorphOS'#010+
   'P*2Tmorphos_MorphOS'#010+
   'S*2Tsolaris_Solaris'#010+
   'S*2Tsolaris_Solaris'#010+
   'S*2Tlinux_Linux'#010+
   'S*2Tlinux_Linux'#010+
-  '**1u<x','>_Undefines the symbol <x>'#010+
+  '**1u<x>_Undefines the symbol <x>'#010+
   '**1U_Unit options:'#010+
   '**1U_Unit options:'#010+
   '**2Un_Do not check where the unit name matches the file name'#010+
   '**2Un_Do not check where the unit name matches the file name'#010+
-  '**2Ur_Generate release unit files (never automatically recompiled)'#010+
+  '**2Ur_Generate release',' unit files (never automatically recompiled)'#010+
   '**2Us_Compile a system unit'#010+
   '**2Us_Compile a system unit'#010+
-  '**1v<x>_Be verbose. <x> is a combinati','on of the following letters:'#010+
+  '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
   '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
   '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
-  '**2*_w : Show warnings               u : Show unit info'#010+
+  '**2*_w : Show warnings        ','       u : Show unit info'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
-  '**2*_h : Show hints   ','               c : Show conditionals'#010+
+  '**2*_h : Show hints                  c : Show conditionals'#010+
   '**2*_i : Show general info           d : Show debug info'#010+
   '**2*_i : Show general info           d : Show debug info'#010+
-  '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
+  '**2*_l : Show linenumbers          ','  r : Rhide/GCC compatibility mod'+
+  'e'#010+
   '**2*_s : Show time stamps            q : Show message numbers'#010+
   '**2*_s : Show time stamps            q : Show message numbers'#010+
-  '**2*_a : Show ','everything             x : Executable info (Win32 only'+
-  ')'#010+
+  '**2*_a : Show everything             x : Executable info (Win32 only)'#010+
   '**2*_b : Write file names messages   p : Write tree.log with parse tre'+
   '**2*_b : Write file names messages   p : Write tree.log with parse tre'+
   'e'#010+
   'e'#010+
-  '**2*_    with full path              v : Write fpcdebug.txt with'#010+
-  '**2*_                                    lots o','f debugging info'#010+
+  '*','*2*_    with full path              v : Write fpcdebug.txt with'#010+
+  '**2*_                                    lots of debugging info'#010+
   '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
   '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
   '**1W<x>_Target-specific options (targets)'#010+
   '**1W<x>_Target-specific options (targets)'#010+
-  '3*2WA_Specify native type application (Windows)'#010+
+  '3*2WA_Specify',' native type application (Windows)'#010+
   '4*2WA_Specify native type application (Windows)'#010+
   '4*2WA_Specify native type application (Windows)'#010+
-  'A*2WA_Specify native type ap','plication (Windows)'#010+
+  'A*2WA_Specify native type application (Windows)'#010+
   '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
   '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
+  'p*2Wb','_Create a bundle instead of a library (Darwin)'#010+
   'A*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'A*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  '4*2Wb_Create',' a bundle instead of a library (Darwin)'#010+
+  '4*2Wb_Create a bundle instead of a library (Darwin)'#010+
   '3*2WB_Create a relocatable image (Windows, Symbian)'#010+
   '3*2WB_Create a relocatable image (Windows, Symbian)'#010+
-  '3*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+
+  '3*2WBxxxx_Set image base to xxxx (Win','dows, Symbian)'#010+
   '4*2WB_Create a relocatable image (Windows)'#010+
   '4*2WB_Create a relocatable image (Windows)'#010+
   '4*2WBxxxx_Set image base to xxxx (Windows)'#010+
   '4*2WBxxxx_Set image base to xxxx (Windows)'#010+
-  'A*2WB_Crea','te a relocatable image (Windows, Symbian)'#010+
+  'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
   'A*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+
   'A*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+
-  '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
+  '3*2WC_Specify console type applicat','ion (EMX, OS/2, Windows)'#010+
   '4*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
   '4*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
-  'A*2WC_Specify console type',' application (Windows)'#010+
+  'A*2WC_Specify console type application (Windows)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
-  '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
+  '3*2WD_Use DEFFILE to export functions of DLL or EX','E (Windows)'#010+
   '4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  'A*2WD_Use DEFFILE to export functions',' of DLL or EXE (Windows)'#010+
+  'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '3*2We_Use external resources (Darwin)'#010+
   '3*2We_Use external resources (Darwin)'#010+
   '4*2We_Use external resources (Darwin)'#010+
   '4*2We_Use external resources (Darwin)'#010+
-  'A*2We_Use external resources (Darwin)'#010+
+  'A*2We_Use external resources',' (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
-  '3*2WF_Specify full-screen',' type application (EMX, OS/2)'#010+
+  '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
-  '4*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
+  '4*2WG_Specify graphic type application ','(EMX, OS/2, Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
-  'P*2WG_Specify graphic type application (C','lassic Mac OS)'#010+
+  'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
   '3*2Wi_Use internal resources (Darwin)'#010+
   '3*2Wi_Use internal resources (Darwin)'#010+
   '4*2Wi_Use internal resources (Darwin)'#010+
   '4*2Wi_Use internal resources (Darwin)'#010+
-  'A*2Wi_Use internal resources (Darwin)'#010+
+  'A*2Wi_Use internal resources (Darwin)'#010,
   'P*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
   'p*2Wi_Use internal resources (Darwin)'#010+
   'p*2Wi_Use internal resources (Darwin)'#010+
-  '3*2WI_Turn on/off the usage of impo','rt sections (Windows)'#010+
+  '3*2WI_Turn on/off the usage of import sections (Windows)'#010+
   '4*2WI_Turn on/off the usage of import sections (Windows)'#010+
   '4*2WI_Turn on/off the usage of import sections (Windows)'#010+
-  'A*2WI_Turn on/off the usage of import sections (Windows)'#010+
+  'A*2WI_Turn on/off the usage of import sections (Wi','ndows)'#010+
   '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
-  '4*2WN_Do not generate relocation c','ode, needed for debugging (Windows'+
-  ')'#010+
+  '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
-  'A*2Wpxxxx_Specify the controller type, see fpc -i for possible values'#010+
-  'V*2Wpxxxx_Specify the controller type, see fpc -i for possible v','alue'+
+  'A*2Wpxxxx_Specify the c','ontroller type, see fpc -i for possible value'+
   's'#010+
   's'#010+
+  'V*2Wpxxxx_Specify the controller type, see fpc -i for possible values'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
   '4*2WR_Generate relocation code (Windows)'#010+
   '4*2WR_Generate relocation code (Windows)'#010+
-  'A*2WR_Generate relocation code (Windows)'#010+
+  'A*2WR_Generate relocation code (Windows)'#010,
   'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
   'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
   '**2WX_Enable executable stack (Linux)'#010+
   '**2WX_Enable executable stack (Linux)'#010+
-  '**1X_Executable ','options:'#010+
+  '**1X_Executable options:'#010+
   '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
   '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
   'ux)'#010+
   'ux)'#010+
-  '**2Xd_Do not use standard library search path (needed for cross compil'+
-  'e)'#010+
+  '**2Xd_Do not use standard library search path ','(needed for cross comp'+
+  'ile)'#010+
   '**2Xe_Use external linker'#010+
   '**2Xe_Use external linker'#010+
-  '**2Xg_Create debuginfo in a separate file and add a debugl','ink sectio'+
-  'n to executable'#010+
+  '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
+  'to executable'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xi_Use internal linker'#010+
-  '**2Xm_Generate link map'#010+
+  '**2Xm_Gen','erate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
   's '#039'main'#039')'#010+
-  '**2XP<x>_Prepend the bin','utils names with the prefix <x>'#010+
+  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
   '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
   '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
-  'ile, see the ld manual for more information) (BeOS, Linux)'#010+
+  'ile, see the ld manual for more',' information) (BeOS, Linux)'#010+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
-  ', Linux, Mac ','OS, Solaris)'#010+
+  ', Linux, Mac OS, Solaris)'#010+
   '**2Xs_Strip all symbols from executable'#010+
   '**2Xs_Strip all symbols from executable'#010+
   '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
   '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
-  '**2Xt_Link with static libraries (-static is passed to linker)'#010+
-  '**2XX_Try to smartlink units             (defines FPC_','LINK_SMART)'#010+
+  '**2Xt_','Link with static libraries (-static is passed to linker)'#010+
+  '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1*_'#010+
   '**1?_Show this help'#010+
   '**1?_Show this help'#010+
   '**1h_Shows this help without waiting'
   '**1h_Shows this help without waiting'

+ 153 - 15
compiler/nadd.pas

@@ -859,7 +859,12 @@ implementation
 
 
             { using sqr(x) for reals instead of x*x might reduces register pressure and/or
             { using sqr(x) for reals instead of x*x might reduces register pressure and/or
               memory accesses while sqr(<real>) has no drawback }
               memory accesses while sqr(<real>) has no drawback }
-            if (nodetype=muln) and
+            if
+{$ifdef cpufpemu}
+               (current_settings.fputype<>fpu_soft) and
+               not(cs_fp_emulation in current_settings.moduleswitches) and
+{$endif cpufpemu}
+               (nodetype=muln) and
                is_real(left.resultdef) and is_real(right.resultdef) and
                is_real(left.resultdef) and is_real(right.resultdef) and
                left.isequal(right) and
                left.isequal(right) and
                not(might_have_sideeffects(left)) then
                not(might_have_sideeffects(left)) then
@@ -868,6 +873,75 @@ implementation
                 left:=nil;
                 left:=nil;
                 exit;
                 exit;
               end;
               end;
+{$ifdef cpurox}
+            { optimize (i shl x) or (i shr (bitsizeof(i)-x)) into rol(x,i) (and different flavours with shl/shr swapped etc.) }
+            if (nodetype=orn)
+{$ifndef cpu64bitalu}
+               and (left.resultdef.typ=orddef) and
+               not(torddef(left.resultdef).ordtype in [s64bit,u64bit,scurrency])
+{$endif cpu64bitalu}
+              then
+              begin
+                if (left.nodetype=shrn) and (right.nodetype=shln) and
+                   is_constintnode(tshlshrnode(left).right) and
+                   is_constintnode(tshlshrnode(right).right) and
+                   (tordconstnode(tshlshrnode(right).right).value>0) and
+                   (tordconstnode(tshlshrnode(left).right).value>0) and
+                   tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
+                   not(might_have_sideeffects(tshlshrnode(left).left)) then
+                   begin
+                     if tordconstnode(tshlshrnode(left).right).value=
+                       tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value then
+                       begin
+                         result:=cinlinenode.create(in_ror_x_y,false,
+                           ccallparanode.create(tshlshrnode(left).right,
+                           ccallparanode.create(tshlshrnode(left).left,nil)));
+                         tshlshrnode(left).left:=nil;
+                         tshlshrnode(left).right:=nil;
+                         exit;
+                       end
+                     else if tordconstnode(tshlshrnode(right).right).value=
+                       tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value then
+                       begin
+                         result:=cinlinenode.create(in_rol_x_y,false,
+                           ccallparanode.create(tshlshrnode(right).right,
+                           ccallparanode.create(tshlshrnode(left).left,nil)));
+                         tshlshrnode(left).left:=nil;
+                         tshlshrnode(right).right:=nil;
+                         exit;
+                       end;
+                   end;
+                if (left.nodetype=shln) and (right.nodetype=shrn) and
+                   is_constintnode(tshlshrnode(left).right) and
+                   is_constintnode(tshlshrnode(right).right) and
+                   (tordconstnode(tshlshrnode(right).right).value>0) and
+                   (tordconstnode(tshlshrnode(left).right).value>0) and
+                   tshlshrnode(left).left.isequal(tshlshrnode(right).left) and
+                   not(might_have_sideeffects(tshlshrnode(left).left)) then
+                   begin
+                     if tordconstnode(tshlshrnode(left).right).value=
+                       tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(right).right).value then
+                       begin
+                         result:=cinlinenode.create(in_rol_x_y,false,
+                           ccallparanode.create(tshlshrnode(left).right,
+                           ccallparanode.create(tshlshrnode(left).left,nil)));
+                         tshlshrnode(left).left:=nil;
+                         tshlshrnode(left).right:=nil;
+                         exit;
+                       end
+                     else if tordconstnode(tshlshrnode(right).right).value=
+                       tshlshrnode(left).left.resultdef.size*8-tordconstnode(tshlshrnode(left).right).value then
+                       begin
+                         result:=cinlinenode.create(in_ror_x_y,false,
+                           ccallparanode.create(tshlshrnode(right).right,
+                           ccallparanode.create(tshlshrnode(left).left,nil)));
+                         tshlshrnode(left).left:=nil;
+                         tshlshrnode(right).right:=nil;
+                         exit;
+                       end;
+                   end;
+              end;
+{$endif cpurox}
           end;
           end;
       end;
       end;
 
 
@@ -1639,10 +1713,32 @@ implementation
                     end;
                     end;
                   st_ansistring :
                   st_ansistring :
                     begin
                     begin
-                      if not(is_ansistring(rd)) then
-                        inserttypeconv(right,cansistringtype);
-                      if not(is_ansistring(ld)) then
-                        inserttypeconv(left,cansistringtype);
+                      { use same code page if possible (don't force same code
+                        page in case both are ansistrings with code page <>
+                        CP_NONE, since then data loss can occur (the ansistring
+                        helpers will convert them at run time to an encoding
+                        that can represent both encodings) }
+                      if is_ansistring(ld) and
+                         (tstringdef(ld).encoding<>0) and
+                         (tstringdef(ld).encoding<>globals.CP_NONE) and
+                         (not is_ansistring(rd) or
+                          (tstringdef(rd).encoding=0) or
+                          (tstringdef(rd).encoding=globals.CP_NONE)) then
+                        inserttypeconv(right,ld)
+                      else if is_ansistring(rd) and
+                         (tstringdef(rd).encoding<>0) and
+                         (tstringdef(rd).encoding<>globals.CP_NONE) and
+                         (not is_ansistring(ld) or
+                          (tstringdef(ld).encoding=0) or
+                          (tstringdef(ld).encoding=globals.CP_NONE)) then
+                        inserttypeconv(left,rd)
+                      else
+                        begin
+                          if not is_ansistring(ld) then
+                            inserttypeconv(left,getansistringdef);
+                          if not is_ansistring(rd) then
+                            inserttypeconv(right,getansistringdef);
+                        end;
                     end;
                     end;
                   st_longstring :
                   st_longstring :
                     begin
                     begin
@@ -1935,6 +2031,14 @@ implementation
                     { for strings, return is always a 255 char string }
                     { for strings, return is always a 255 char string }
                     if is_shortstring(left.resultdef) then
                     if is_shortstring(left.resultdef) then
                       resultdef:=cshortstringtype
                       resultdef:=cshortstringtype
+                    else
+                    { for ansistrings set resultdef to assignment left node
+                      if it is an assignment and left node expects ansistring }
+                    if is_ansistring(left.resultdef) and
+                       assigned(aktassignmentnode) and
+                       (aktassignmentnode.right=self) and
+                       is_ansistring(aktassignmentnode.left.resultdef) then
+                      resultdef:=aktassignmentnode.left.resultdef
                     else
                     else
                       resultdef:=left.resultdef;
                       resultdef:=left.resultdef;
                   end;
                   end;
@@ -1983,6 +2087,7 @@ implementation
         newstatement : tstatementnode;
         newstatement : tstatementnode;
         tempnode (*,tempnode2*) : ttempcreatenode;
         tempnode (*,tempnode2*) : ttempcreatenode;
         cmpfuncname: string;
         cmpfuncname: string;
+        para: tcallparanode;
       begin
       begin
         { when we get here, we are sure that both the left and the right }
         { when we get here, we are sure that both the left and the right }
         { node are both strings of the same stringtype (JM)              }
         { node are both strings of the same stringtype (JM)              }
@@ -2011,11 +2116,26 @@ implementation
                   (aktassignmentnode.left.resultdef=resultdef) and
                   (aktassignmentnode.left.resultdef=resultdef) and
                   valid_for_var(aktassignmentnode.left,false) then
                   valid_for_var(aktassignmentnode.left,false) then
                 begin
                 begin
-                  result:=ccallnode.createintern('fpc_'+
-                    tstringdef(resultdef).stringtypname+'_concat',
-                    ccallparanode.create(right,
-                    ccallparanode.create(left,
-                    ccallparanode.create(aktassignmentnode.left.getcopy,nil))));
+                  para:=ccallparanode.create(
+                          right,
+                          ccallparanode.create(
+                            left,
+                            ccallparanode.create(aktassignmentnode.left.getcopy,nil)
+                          )
+                        );
+                  if is_ansistring(resultdef) then
+                    para:=ccallparanode.create(
+                            cordconstnode.create(
+                              getparaencoding(resultdef),
+                              u16inttype,
+                              true
+                            ),
+                            para
+                          );
+                  result:=ccallnode.createintern(
+                            'fpc_'+tstringdef(resultdef).stringtypname+'_concat',
+                            para
+                          );
                   include(aktassignmentnode.flags,nf_assign_done_in_right);
                   include(aktassignmentnode.flags,nf_assign_done_in_right);
                   firstpass(result);
                   firstpass(result);
                 end
                 end
@@ -2024,11 +2144,29 @@ implementation
                   result:=internalstatements(newstatement);
                   result:=internalstatements(newstatement);
                   tempnode:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,true);
                   tempnode:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,true);
                   addstatement(newstatement,tempnode);
                   addstatement(newstatement,tempnode);
-                  addstatement(newstatement,ccallnode.createintern('fpc_'+
-                    tstringdef(resultdef).stringtypname+'_concat',
-                    ccallparanode.create(right,
-                    ccallparanode.create(left,
-                    ccallparanode.create(ctemprefnode.create(tempnode),nil)))));
+                  para:=ccallparanode.create(
+                          right,
+                          ccallparanode.create(
+                            left,
+                            ccallparanode.create(ctemprefnode.create(tempnode),nil)
+                          )
+                        );
+                  if is_ansistring(resultdef) then
+                    para:=ccallparanode.create(
+                            cordconstnode.create(
+                              getparaencoding(resultdef),
+                              u16inttype,
+                              true
+                            ),
+                            para
+                          );
+                  addstatement(
+                    newstatement,
+                    ccallnode.createintern(
+                      'fpc_'+tstringdef(resultdef).stringtypname+'_concat',
+                      para
+                    )
+                  );
                   addstatement(newstatement,ctempdeletenode.create_normal_temp(tempnode));
                   addstatement(newstatement,ctempdeletenode.create_normal_temp(tempnode));
                   addstatement(newstatement,ctemprefnode.create(tempnode));
                   addstatement(newstatement,ctemprefnode.create(tempnode));
                 end;
                 end;

+ 3 - 3
compiler/nbas.pas

@@ -508,11 +508,11 @@ implementation
     function tblocknode.pass_1 : tnode;
     function tblocknode.pass_1 : tnode;
       var
       var
          hp : tstatementnode;
          hp : tstatementnode;
-         count : longint;
+         //count : longint;
       begin
       begin
          result:=nil;
          result:=nil;
          expectloc:=LOC_VOID;
          expectloc:=LOC_VOID;
-         count:=0;
+         //count:=0;
          hp:=tstatementnode(left);
          hp:=tstatementnode(left);
          while assigned(hp) do
          while assigned(hp) do
            begin
            begin
@@ -523,7 +523,7 @@ implementation
                    hp.expectloc:=hp.left.expectloc;
                    hp.expectloc:=hp.left.expectloc;
                 end;
                 end;
               expectloc:=hp.expectloc;
               expectloc:=hp.expectloc;
-              inc(count);
+              //inc(count);
               hp:=tstatementnode(hp.right);
               hp:=tstatementnode(hp.right);
            end;
            end;
       end;
       end;

+ 19 - 6
compiler/ncal.pas

@@ -1638,7 +1638,7 @@ implementation
     function tcallnode.gen_self_tree:tnode;
     function tcallnode.gen_self_tree:tnode;
       var
       var
         selftree : tnode;
         selftree : tnode;
-        selfdef  : tabstractrecorddef;
+        selfdef  : tdef;
       begin
       begin
         selftree:=nil;
         selftree:=nil;
 
 
@@ -1692,7 +1692,8 @@ implementation
                 selfdef:=tobjectdef(tprocdef(procdefinition).struct).extendeddef
                 selfdef:=tobjectdef(tprocdef(procdefinition).struct).extendeddef
               else
               else
                 selfdef:=tprocdef(procdefinition).struct;
                 selfdef:=tprocdef(procdefinition).struct;
-              if (oo_has_vmt in selfdef.objectoptions) then
+              if (selfdef.typ in [recorddef,objectdef]) and
+                  (oo_has_vmt in tabstractrecorddef(selfdef).objectoptions) then
                 begin
                 begin
                   { we only need the vmt, loading self is not required and there is no
                   { we only need the vmt, loading self is not required and there is no
                     need to check for typen, because that will always get the
                     need to check for typen, because that will always get the
@@ -1835,7 +1836,8 @@ implementation
           realresdef:=tstoreddef(typedef);
           realresdef:=tstoreddef(typedef);
         if realresdef.is_intregable then
         if realresdef.is_intregable then
           result:=LOC_REGISTER
           result:=LOC_REGISTER
-        else if realresdef.is_fpuregable then
+        else if (realresdef.typ=floatdef) and
+          not(cs_fp_emulation in current_settings.moduleswitches) then
           if use_vectorfpu(realresdef) then
           if use_vectorfpu(realresdef) then
             result:=LOC_MMREGISTER
             result:=LOC_MMREGISTER
           else
           else
@@ -2091,7 +2093,8 @@ implementation
                   begin
                   begin
                     if (current_procinfo.procdef.proctypeoption=potype_constructor) and
                     if (current_procinfo.procdef.proctypeoption=potype_constructor) and
                        (procdefinition.proctypeoption=potype_constructor) and
                        (procdefinition.proctypeoption=potype_constructor) and
-                       (nf_is_self in methodpointer.flags) then
+                       (methodpointer.nodetype=loadn) and
+                       (loadnf_is_self in tloadnode(methodpointer).loadnodeflags) then
                       vmttree:=cpointerconstnode.create(0,voidpointertype)
                       vmttree:=cpointerconstnode.create(0,voidpointertype)
                     else
                     else
                       vmttree:=cpointerconstnode.create(1,voidpointertype);
                       vmttree:=cpointerconstnode.create(1,voidpointertype);
@@ -2421,7 +2424,8 @@ implementation
           called, indirect constructor calls cannot be checked.
           called, indirect constructor calls cannot be checked.
         }
         }
         if assigned(methodpointer) and
         if assigned(methodpointer) and
-           not (nf_is_self in methodpointer.flags) then
+           not((methodpointer.nodetype=loadn) and
+               (loadnf_is_self in tloadnode(methodpointer).loadnodeflags)) then
           begin
           begin
             if (methodpointer.resultdef.typ = objectdef) then
             if (methodpointer.resultdef.typ = objectdef) then
               objectdf:=tobjectdef(methodpointer.resultdef)
               objectdf:=tobjectdef(methodpointer.resultdef)
@@ -2938,7 +2942,8 @@ implementation
               if (procdefinition.proctypeoption=potype_constructor) and
               if (procdefinition.proctypeoption=potype_constructor) and
                  is_class(tprocdef(procdefinition).struct) and
                  is_class(tprocdef(procdefinition).struct) and
                  assigned(methodpointer) and
                  assigned(methodpointer) and
-                 (nf_is_self in methodpointer.flags) then
+                 (methodpointer.nodetype=loadn) and
+                 (loadnf_is_self in tloadnode(methodpointer).loadnodeflags) then
                 resultdef:=voidtype
                 resultdef:=voidtype
               else
               else
                 resultdef:=procdefinition.returndef;
                 resultdef:=procdefinition.returndef;
@@ -2966,6 +2971,14 @@ implementation
                   CGMessage(cg_e_cant_call_abstract_method);
                   CGMessage(cg_e_cant_call_abstract_method);
               end;
               end;
 
 
+            { directly calling an interface/protocol/category/class helper
+              method via its type is not possible (always must be called via
+              the actual instance) }
+            if (methodpointer.nodetype=typen) and
+               (is_interface(methodpointer.resultdef) or
+                is_objc_protocol_or_category(methodpointer.resultdef)) then
+              CGMessage1(type_e_class_type_expected,methodpointer.resultdef.typename);
+
             { if an inherited con- or destructor should be  }
             { if an inherited con- or destructor should be  }
             { called in a con- or destructor then a warning }
             { called in a con- or destructor then a warning }
             { will be made                                  }
             { will be made                                  }

+ 4 - 0
compiler/ncgcal.pas

@@ -273,6 +273,10 @@ implementation
                              TCGCALLNODE
                              TCGCALLNODE
 *****************************************************************************}
 *****************************************************************************}
 
 
+{$if first_mm_imreg = 0}
+  {$WARN 4044 OFF} { Comparison might be always false ... }
+{$endif}
+
     procedure tcgcallnode.extra_interrupt_code;
     procedure tcgcallnode.extra_interrupt_code;
       begin
       begin
       end;
       end;

+ 6 - 4
compiler/ncgcnv.pas

@@ -34,6 +34,11 @@ interface
        { tcgtypeconvnode }
        { tcgtypeconvnode }
 
 
        tcgtypeconvnode = class(ttypeconvnode)
        tcgtypeconvnode = class(ttypeconvnode)
+       protected
+{$ifdef cpuflags}
+         { CPUs without flags need a specific implementation of int -> bool }
+         procedure second_int_to_bool;override;
+{$endif cpuflags}
          procedure second_int_to_int;override;
          procedure second_int_to_int;override;
          procedure second_cstring_to_pchar;override;
          procedure second_cstring_to_pchar;override;
          procedure second_cstring_to_int;override;
          procedure second_cstring_to_int;override;
@@ -51,11 +56,8 @@ interface
          procedure second_class_to_intf;override;
          procedure second_class_to_intf;override;
          procedure second_char_to_char;override;
          procedure second_char_to_char;override;
          procedure second_nothing;override;
          procedure second_nothing;override;
+       public
          procedure pass_generate_code;override;
          procedure pass_generate_code;override;
-{$ifdef cpuflags}
-         { CPUs without flags need a specific implementation of int -> bool }
-         procedure second_int_to_bool;override;
-{$endif cpuflags}
        end;
        end;
 
 
        tcgasnode = class(tasnode)
        tcgasnode = class(tasnode)

+ 13 - 17
compiler/ncgcon.pas

@@ -139,9 +139,6 @@ implementation
         { const already used ? }
         { const already used ? }
         if not assigned(lab_real) then
         if not assigned(lab_real) then
           begin
           begin
-            if current_asmdata.ConstPools[sp_floats] = nil then
-              current_asmdata.ConstPools[sp_floats] := THashSet.Create(64, True, False);
-
             { there may be gap between record fields, zero it out }
             { there may be gap between record fields, zero it out }
             fillchar(key,sizeof(key),0);
             fillchar(key,sizeof(key),0);
             key.value:=value_real;
             key.value:=value_real;
@@ -255,11 +252,10 @@ implementation
 
 
     procedure tcgstringconstnode.pass_generate_code;
     procedure tcgstringconstnode.pass_generate_code;
       var
       var
-         lastlabel   : tasmlabel;
-         pc       : pchar;
+         lastlabel: tasmlabel;
+         pc: pchar;
          l: longint;
          l: longint;
          href: treference;
          href: treference;
-         pooltype: TConstPoolType;
          pool: THashSet;
          pool: THashSet;
          entry: PHashSetItem;
          entry: PHashSetItem;
 
 
@@ -283,15 +279,15 @@ implementation
          { const already used ? }
          { const already used ? }
          if not assigned(lab_str) then
          if not assigned(lab_str) then
            begin
            begin
-              pooltype := PoolMap[cst_type];
-              if current_asmdata.ConstPools[pooltype] = nil then
-                current_asmdata.ConstPools[pooltype] := THashSet.Create(64, True, False);
-              pool := current_asmdata.ConstPools[pooltype];
+              pool := current_asmdata.ConstPools[PoolMap[cst_type]];
 
 
               if cst_type in [cst_widestring, cst_unicodestring] then
               if cst_type in [cst_widestring, cst_unicodestring] then
-                entry := pool.FindOrAdd(pcompilerwidestring(value_str)^.data, len*cwidechartype.size)
+                entry := pool.FindOrAdd(pcompilerwidestring(value_str)^.data,len*cwidechartype.size)
+              else
+              if cst_type = cst_ansistring then
+                entry := PHashSetItem(TTagHashSet(pool).FindOrAdd(value_str,len,tstringdef(resultdef).encoding))
               else
               else
-                entry := pool.FindOrAdd(value_str, len);
+                entry := pool.FindOrAdd(value_str,len);
 
 
               lab_str := TAsmLabel(entry^.Data);  // is it needed anymore?
               lab_str := TAsmLabel(entry^.Data);  // is it needed anymore?
 
 
@@ -304,7 +300,7 @@ implementation
                            if len=0 then
                            if len=0 then
                              InternalError(2008032301)   { empty string should be handled above }
                              InternalError(2008032301)   { empty string should be handled above }
                            else
                            else
-                             lastlabel:=emit_ansistring_const(current_asmdata.AsmLists[al_typedconsts],value_str,len);
+                             lastlabel:=emit_ansistring_const(current_asmdata.AsmLists[al_typedconsts],value_str,len,tstringdef(resultdef).encoding);
                         end;
                         end;
                       cst_unicodestring,
                       cst_unicodestring,
                       cst_widestring:
                       cst_widestring:
@@ -314,6 +310,7 @@ implementation
                            else
                            else
                              lastlabel := emit_unicodestring_const(current_asmdata.AsmLists[al_typedconsts],
                              lastlabel := emit_unicodestring_const(current_asmdata.AsmLists[al_typedconsts],
                                              value_str,
                                              value_str,
+                                             tstringdef(resultdef).encoding,
                                              (cst_type=cst_widestring) and (tf_winlikewidestring in target_info.flags));
                                              (cst_type=cst_widestring) and (tf_winlikewidestring in target_info.flags));
                         end;
                         end;
                       cst_shortstring:
                       cst_shortstring:
@@ -414,8 +411,6 @@ implementation
           { const already used ? }
           { const already used ? }
           if not assigned(lab_set) then
           if not assigned(lab_set) then
             begin
             begin
-              if current_asmdata.ConstPools[sp_varsets] = nil then
-                current_asmdata.ConstPools[sp_varsets] := THashSet.Create(64, True, False);
               entry := current_asmdata.ConstPools[sp_varsets].FindOrAdd(value_set, 32);
               entry := current_asmdata.ConstPools[sp_varsets].FindOrAdd(value_set, 32);
 
 
               lab_set := TAsmLabel(entry^.Data);  // is it needed anymore?
               lab_set := TAsmLabel(entry^.Data);  // is it needed anymore?
@@ -463,7 +458,7 @@ implementation
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
-                          TCGPOINTERCONSTNODE
+                          TCGGUIDCONSTNODE
 *****************************************************************************}
 *****************************************************************************}
 
 
     procedure tcgguidconstnode.pass_generate_code;
     procedure tcgguidconstnode.pass_generate_code;
@@ -474,7 +469,8 @@ implementation
         location_reset_ref(location,LOC_CREFERENCE,OS_NO,const_align(16));
         location_reset_ref(location,LOC_CREFERENCE,OS_NO,const_align(16));
         { label for GUID }
         { label for GUID }
         current_asmdata.getdatalabel(tmplabel);
         current_asmdata.getdatalabel(tmplabel);
-        current_asmdata.asmlists[al_typedconsts].concat(tai_align.create(const_align(16)));
+        maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]);
+        new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,tmplabel.name,const_align(16));
         current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(tmplabel));
         current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(tmplabel));
         current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint(value.D1)));
         current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint(value.D1)));
         current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D2));
         current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D2));

+ 89 - 145
compiler/ncgflw.pas

@@ -98,7 +98,7 @@ implementation
       nld,ncon,
       nld,ncon,
       tgobj,paramgr,
       tgobj,paramgr,
       regvars,
       regvars,
-      cgutils,cgobj
+      cgutils,cgobj,nutils
       ;
       ;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -839,8 +839,10 @@ implementation
          include(flowcontrol,fc_exit);
          include(flowcontrol,fc_exit);
          if assigned(left) then
          if assigned(left) then
            secondpass(left);
            secondpass(left);
-
-         cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel);
+         if (fc_unwind in flowcontrol) then
+           cg.g_local_unwind(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel)
+         else
+           cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel);
        end;
        end;
 
 
 
 
@@ -858,7 +860,10 @@ implementation
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
              load_all_regvars(current_asmdata.CurrAsmList);
              load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 {$endif OLDREGVARS}
-             cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
+             if (fc_unwind in flowcontrol) then
+               cg.g_local_unwind(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
+             else
+               cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
            end
            end
          else
          else
            CGMessage(cg_e_break_not_allowed);
            CGMessage(cg_e_break_not_allowed);
@@ -879,7 +884,10 @@ implementation
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
              load_all_regvars(current_asmdata.CurrAsmList);
              load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 {$endif OLDREGVARS}
-             cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
+             if (fc_unwind in flowcontrol) then
+               cg.g_local_unwind(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
+             else
+               cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
            end
            end
          else
          else
            CGMessage(cg_e_continue_not_allowed);
            CGMessage(cg_e_continue_not_allowed);
@@ -1031,22 +1039,26 @@ implementation
     { does the necessary things to clean up the object stack }
     { does the necessary things to clean up the object stack }
     { in the except block                                    }
     { in the except block                                    }
     procedure cleanupobjectstack;
     procedure cleanupobjectstack;
+      begin
+         cg.g_call(current_asmdata.CurrAsmList,'FPC_DONEEXCEPTION');
+      end;
+
+    { generates code to be executed when another exeception is raised while
+      control is inside except block }
+    procedure handle_nested_exception(list:TAsmList;const t:texceptiontemps;entrylabel:TAsmLabel);
       var
       var
-        paraloc1 : tcgpara;
+         exitlabel: tasmlabel;
       begin
       begin
-         cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPOBJECTSTACK',false);
-         cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
-         paraloc1.init;
-         paramanager.getintparaloc(pocall_default,1,paraloc1);
-         cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
-         cg.a_load_reg_cgpara(current_asmdata.CurrAsmList,OS_ADDR,NR_FUNCTION_RESULT_REG,paraloc1);
-         paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-         cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DESTROYEXCEPTION',false);
-         cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-         paraloc1.done;
+         { don't generate line info for internal cleanup }
+         list.concat(tai_marker.create(mark_NoLineInfoStart));
+         current_asmdata.getjumplabel(exitlabel);
+         cg.a_label(list,entrylabel);
+         free_exception(list,t,0,exitlabel,false);
+         { we don't need to save/restore registers here because reraise never }
+         { returns                                                            }
+         cg.a_call_name(list,'FPC_RAISE_NESTED',false);
+         cg.a_label(list,exitlabel);
+         cleanupobjectstack;
       end;
       end;
 
 
 
 
@@ -1061,7 +1073,6 @@ implementation
          exittrylabel,
          exittrylabel,
          continuetrylabel,
          continuetrylabel,
          breaktrylabel,
          breaktrylabel,
-         doobjectdestroy,
          doobjectdestroyandreraise,
          doobjectdestroyandreraise,
          oldCurrExitLabel,
          oldCurrExitLabel,
          oldContinueLabel,
          oldContinueLabel,
@@ -1070,7 +1081,6 @@ implementation
          exceptflowcontrol : tflowcontrol;
          exceptflowcontrol : tflowcontrol;
          destroytemps,
          destroytemps,
          excepttemps : texceptiontemps;
          excepttemps : texceptiontemps;
-         paraloc1 : tcgpara;
       label
       label
          errorexit;
          errorexit;
       begin
       begin
@@ -1158,63 +1168,40 @@ implementation
          { default handling except handling }
          { default handling except handling }
          if assigned(t1) then
          if assigned(t1) then
            begin
            begin
-              { FPC_CATCHES must be called with
-                'default handler' flag (=-1)
+              { FPC_CATCHES with 'default handler' flag (=-1) need no longer be called,
+                it doesn't change any state and its return value is ignored (Sergei)
               }
               }
-              paraloc1.init;
-              paramanager.getintparaloc(pocall_default,1,paraloc1);
-              cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_ADDR,-1,paraloc1);
-              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CATCHES',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-              paraloc1.done;
 
 
               { the destruction of the exception object must be also }
               { the destruction of the exception object must be also }
-              { guarded by an exception frame                        }
-              current_asmdata.getjumplabel(doobjectdestroy);
-              current_asmdata.getjumplabel(doobjectdestroyandreraise);
+              { guarded by an exception frame, but it can be omitted }
+              { if there's no user code in 'except' block            }
 
 
-              get_exception_temps(current_asmdata.CurrAsmList,destroytemps);
-              new_exception(current_asmdata.CurrAsmList,destroytemps,doobjectdestroyandreraise);
-
-              { except block needs line info }
-              current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
-
-              { here we don't have to reset flowcontrol           }
-              { the default and on flowcontrols are handled equal }
-              secondpass(t1);
-              exceptflowcontrol:=flowcontrol;
+              if not (has_no_code(t1)) then
+               begin
+                 current_asmdata.getjumplabel(doobjectdestroyandreraise);
 
 
-              { don't generate line info for internal cleanup }
-              current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
+                 get_exception_temps(current_asmdata.CurrAsmList,destroytemps);
+                 new_exception(current_asmdata.CurrAsmList,destroytemps,doobjectdestroyandreraise);
 
 
-              cg.a_label(current_asmdata.CurrAsmList,doobjectdestroyandreraise);
+                 { except block needs line info }
+                 current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
 
 
-              free_exception(current_asmdata.CurrAsmList,destroytemps,0,doobjectdestroy,false);
+                 { here we don't have to reset flowcontrol           }
+                 { the default and on flowcontrols are handled equal }
+                 secondpass(t1);
+                 exceptflowcontrol:=flowcontrol;
 
 
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPSECONDOBJECTSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
+                 handle_nested_exception(current_asmdata.CurrAsmList,destroytemps,doobjectdestroyandreraise);
 
 
-              paraloc1.init;
-              paramanager.getintparaloc(pocall_default,1,paraloc1);
-              cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
-              cg.a_load_reg_cgpara(current_asmdata.CurrAsmList, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1);
-              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DESTROYEXCEPTION',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-              paraloc1.done;
-              { we don't need to restore esi here because reraise never }
-              { returns                                                 }
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE',false);
-
-              cg.a_label(current_asmdata.CurrAsmList,doobjectdestroy);
-              cleanupobjectstack;
-              unget_exception_temps(current_asmdata.CurrAsmList,destroytemps);
-              cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
+                 unget_exception_temps(current_asmdata.CurrAsmList,destroytemps);
+                 cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
+               end
+               else
+                 begin
+                   exceptflowcontrol:=flowcontrol;
+                   cleanupobjectstack;
+                   cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
+                 end;
            end
            end
          else
          else
            begin
            begin
@@ -1228,9 +1215,7 @@ implementation
               cg.a_label(current_asmdata.CurrAsmList,exitexceptlabel);
               cg.a_label(current_asmdata.CurrAsmList,exitexceptlabel);
               { we must also destroy the address frame which guards }
               { we must also destroy the address frame which guards }
               { exception object                                    }
               { exception object                                    }
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.g_call(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK');
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cleanupobjectstack;
               cleanupobjectstack;
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
@@ -1243,9 +1228,7 @@ implementation
               cg.a_label(current_asmdata.CurrAsmList,breakexceptlabel);
               cg.a_label(current_asmdata.CurrAsmList,breakexceptlabel);
               { we must also destroy the address frame which guards }
               { we must also destroy the address frame which guards }
               { exception object                                    }
               { exception object                                    }
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.g_call(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK');
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cleanupobjectstack;
               cleanupobjectstack;
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
@@ -1258,9 +1241,7 @@ implementation
               cg.a_label(current_asmdata.CurrAsmList,continueexceptlabel);
               cg.a_label(current_asmdata.CurrAsmList,continueexceptlabel);
               { we must also destroy the address frame which guards }
               { we must also destroy the address frame which guards }
               { exception object                                    }
               { exception object                                    }
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.g_call(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK');
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cleanupobjectstack;
               cleanupobjectstack;
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
@@ -1272,9 +1253,7 @@ implementation
            begin
            begin
               { do some magic for exit in the try block }
               { do some magic for exit in the try block }
               cg.a_label(current_asmdata.CurrAsmList,exittrylabel);
               cg.a_label(current_asmdata.CurrAsmList,exittrylabel);
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.g_call(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK');
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
               { from g_exception_reason_load  }
               { from g_exception_reason_load  }
@@ -1284,9 +1263,7 @@ implementation
          if fc_break in tryflowcontrol then
          if fc_break in tryflowcontrol then
            begin
            begin
               cg.a_label(current_asmdata.CurrAsmList,breaktrylabel);
               cg.a_label(current_asmdata.CurrAsmList,breaktrylabel);
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.g_call(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK');
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel);
               { from g_exception_reason_load  }
               { from g_exception_reason_load  }
@@ -1296,9 +1273,7 @@ implementation
          if fc_continue in tryflowcontrol then
          if fc_continue in tryflowcontrol then
            begin
            begin
               cg.a_label(current_asmdata.CurrAsmList,continuetrylabel);
               cg.a_label(current_asmdata.CurrAsmList,continuetrylabel);
-              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK',false);
-              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.g_call(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK');
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
               cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel);
               { from g_exception_reason_load  }
               { from g_exception_reason_load  }
@@ -1337,11 +1312,9 @@ implementation
          oldCurrExitLabel,
          oldCurrExitLabel,
          oldContinueLabel,
          oldContinueLabel,
          doobjectdestroyandreraise,
          doobjectdestroyandreraise,
-         doobjectdestroy,
          oldBreakLabel : tasmlabel;
          oldBreakLabel : tasmlabel;
          oldflowcontrol : tflowcontrol;
          oldflowcontrol : tflowcontrol;
          excepttemps : texceptiontemps;
          excepttemps : texceptiontemps;
-         exceptref,
          href2: treference;
          href2: treference;
          paraloc1 : tcgpara;
          paraloc1 : tcgpara;
          exceptvarsym : tlocalvarsym;
          exceptvarsym : tlocalvarsym;
@@ -1358,9 +1331,7 @@ implementation
          paramanager.getintparaloc(pocall_default,1,paraloc1);
          paramanager.getintparaloc(pocall_default,1,paraloc1);
          cg.a_loadaddr_ref_cgpara(current_asmdata.CurrAsmList,href2,paraloc1);
          cg.a_loadaddr_ref_cgpara(current_asmdata.CurrAsmList,href2,paraloc1);
          paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
          paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-         cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CATCHES',false);
-         cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+         cg.g_call(current_asmdata.CurrAsmList,'FPC_CATCHES');
 
 
          cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
          cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
          { is it this catch? No. go to next onlabel }
          { is it this catch? No. go to next onlabel }
@@ -1378,11 +1349,6 @@ implementation
              exceptvarsym.localloc.size:=OS_ADDR;
              exceptvarsym.localloc.size:=OS_ADDR;
              tg.GetLocal(current_asmdata.CurrAsmList,sizeof(pint),voidpointertype,exceptvarsym.localloc.reference);
              tg.GetLocal(current_asmdata.CurrAsmList,sizeof(pint),voidpointertype,exceptvarsym.localloc.reference);
              cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,exceptvarsym.localloc.reference);
              cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,exceptvarsym.localloc.reference);
-           end
-         else
-           begin
-             tg.GetTemp(current_asmdata.CurrAsmList,sizeof(pint),sizeof(pint),tt_normal,exceptref);
-             cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,exceptref);
            end;
            end;
          cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
          cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
 
 
@@ -1414,39 +1380,14 @@ implementation
               secondpass(right);
               secondpass(right);
            end;
            end;
 
 
-         { don't generate lineinfo for internal cleanup }
-         current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoStart));
-
-         current_asmdata.getjumplabel(doobjectdestroy);
-         cg.a_label(current_asmdata.CurrAsmList,doobjectdestroyandreraise);
+         handle_nested_exception(current_asmdata.CurrAsmList,excepttemps,doobjectdestroyandreraise);
 
 
-         free_exception(current_asmdata.CurrAsmList,excepttemps,0,doobjectdestroy,false);
-
-         cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPSECONDOBJECTSTACK',false);
-         cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
-         paramanager.getintparaloc(pocall_default,1,paraloc1);
-         cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
-         cg.a_load_reg_cgpara(current_asmdata.CurrAsmList, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1);
-         paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-         cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-         cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DESTROYEXCEPTION',false);
-         cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-         { we don't need to store/restore registers here because reraise never
-           returns                                                             }
-         cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE',false);
-
-         cg.a_label(current_asmdata.CurrAsmList,doobjectdestroy);
-         cleanupobjectstack;
          { clear some stuff }
          { clear some stuff }
          if assigned(exceptvarsym) then
          if assigned(exceptvarsym) then
            begin
            begin
              tg.UngetLocal(current_asmdata.CurrAsmList,exceptvarsym.localloc.reference);
              tg.UngetLocal(current_asmdata.CurrAsmList,exceptvarsym.localloc.reference);
              exceptvarsym.localloc.loc:=LOC_INVALID;
              exceptvarsym.localloc.loc:=LOC_INVALID;
-           end
-         else
-           tg.Ungettemp(current_asmdata.CurrAsmList,exceptref);
+           end;
          cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
          cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel);
 
 
          if assigned(right) then
          if assigned(right) then
@@ -1616,28 +1557,31 @@ implementation
          else
          else
            begin
            begin
              cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
              cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel);
-             cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG);
-             cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel);
-             if fc_exit in tryflowcontrol then
-               begin
-                  cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG);
-                  cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldCurrExitLabel);
-                  decconst:=1;
-               end
-             else
-               decconst:=2;
-             if fc_break in tryflowcontrol then
-               begin
-                  cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG);
-                  cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldBreakLabel);
-                  decconst:=1;
-               end
-             else
-               inc(decconst);
-             if fc_continue in tryflowcontrol then
+             if (tryflowcontrol*[fc_exit,fc_break,fc_continue]<>[]) then
                begin
                begin
-                  cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG);
-                  cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldContinueLabel);
+                 cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG);
+                 cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel);
+                 if fc_exit in tryflowcontrol then
+                   begin
+                     cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG);
+                     cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldCurrExitLabel);
+                     decconst:=1;
+                   end
+                 else
+                   decconst:=2;
+                 if fc_break in tryflowcontrol then
+                   begin
+                     cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG);
+                     cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldBreakLabel);
+                     decconst:=1;
+                   end
+                 else
+                   inc(decconst);
+                 if fc_continue in tryflowcontrol then
+                   begin
+                     cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG);
+                     cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldContinueLabel);
+                   end;
                end;
                end;
              cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
              cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG);
              cg.a_label(current_asmdata.CurrAsmList,reraiselabel);
              cg.a_label(current_asmdata.CurrAsmList,reraiselabel);

+ 1 - 2
compiler/ncginl.pas

@@ -328,7 +328,6 @@ implementation
      end;
      end;
 
 
 
 
-
 {*****************************************************************************
 {*****************************************************************************
                           LENGTH GENERIC HANDLING
                           LENGTH GENERIC HANDLING
 *****************************************************************************}
 *****************************************************************************}
@@ -363,7 +362,7 @@ implementation
                hregister:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_INT);
                hregister:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_INT);
                cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hregister);
                cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hregister);
              end;
              end;
-           if is_widestring(left.resultdef) or is_unicodestring(left.resultdef) then
+           if is_widestring(left.resultdef) then
              cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,1,hregister);
              cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,1,hregister);
            cg.a_label(current_asmdata.CurrAsmList,lengthlab);
            cg.a_label(current_asmdata.CurrAsmList,lengthlab);
            location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
            location_reset(location,LOC_REGISTER,def_cgsize(resultdef));

+ 3 - 2
compiler/ncgld.pas

@@ -496,7 +496,7 @@ implementation
 
 
                      { virtual method ? }
                      { virtual method ? }
                      if (po_virtualmethod in procdef.procoptions) and
                      if (po_virtualmethod in procdef.procoptions) and
-                        not(nf_inherited in flags) and
+                        not(loadnf_inherited in loadnodeflags) and
                         not is_objectpascal_helper(procdef.struct) then
                         not is_objectpascal_helper(procdef.struct) then
                        begin
                        begin
                          if (not assigned(current_procinfo) or
                          if (not assigned(current_procinfo) or
@@ -780,7 +780,8 @@ implementation
                             len:=left.resultdef.size;
                             len:=left.resultdef.size;
 
 
                             { data smaller than an aint has less alignment requirements }
                             { data smaller than an aint has less alignment requirements }
-                            alignmentrequirement:=min(len,sizeof(aint));
+                            { max(1,...) avoids div by zero in case of an empty record  }
+                            alignmentrequirement:=min(max(1,len),sizeof(aint));
 
 
                             if (right.location.reference.offset mod alignmentrequirement<>0) or
                             if (right.location.reference.offset mod alignmentrequirement<>0) or
                               (left.location.reference.offset mod alignmentrequirement<>0) or
                               (left.location.reference.offset mod alignmentrequirement<>0) or

+ 0 - 2
compiler/ncgmem.pas

@@ -114,8 +114,6 @@ implementation
                end
                end
              else
              else
                begin
                begin
-                 if current_asmdata.ConstPools[sp_objcclassnamerefs]=nil then
-                   current_asmdata.ConstPools[sp_objcclassnamerefs]:=THashSet.Create(64, True, False);
                  pool:=current_asmdata.ConstPools[sp_objcclassnamerefs];
                  pool:=current_asmdata.ConstPools[sp_objcclassnamerefs];
                  entry:=pool.FindOrAdd(@tobjectdef(left.resultdef).objextname^[1],length(tobjectdef(left.resultdef).objextname^));
                  entry:=pool.FindOrAdd(@tobjectdef(left.resultdef).objextname^[1],length(tobjectdef(left.resultdef).objextname^));
                  if (target_info.system in systems_objc_nfabi) then
                  if (target_info.system in systems_objc_nfabi) then

+ 0 - 2
compiler/ncgobjc.pas

@@ -58,8 +58,6 @@ procedure tcgobjcselectornode.pass_generate_code;
     entry  : PHashSetItem;
     entry  : PHashSetItem;
     name   : pshortstring;
     name   : pshortstring;
   begin
   begin
-    if current_asmdata.ConstPools[sp_varnamerefs]=nil then
-      current_asmdata.ConstPools[sp_varnamerefs]:=THashSet.Create(64, True, False);
     pool:=current_asmdata.ConstPools[sp_varnamerefs];
     pool:=current_asmdata.ConstPools[sp_varnamerefs];
 
 
     case left.nodetype of
     case left.nodetype of

+ 6 - 8
compiler/ncgutil.pas

@@ -190,6 +190,9 @@ implementation
 {*****************************************************************************
 {*****************************************************************************
                                   Misc Helpers
                                   Misc Helpers
 *****************************************************************************}
 *****************************************************************************}
+{$if first_mm_imreg = 0}
+  {$WARN 4044 OFF} { Comparison might be always false ... }
+{$endif}
 
 
     procedure location_free(list: TAsmList; const location : TLocation);
     procedure location_free(list: TAsmList; const location : TLocation);
       begin
       begin
@@ -1377,10 +1380,8 @@ implementation
            trashintval := trashintvalues[localvartrashing];
            trashintval := trashintvalues[localvartrashing];
            case tabstractnormalvarsym(p).initialloc.loc of
            case tabstractnormalvarsym(p).initialloc.loc of
              LOC_CREGISTER :
              LOC_CREGISTER :
-{$ifopt q+}
-{$define overflowon}
+{$push}
 {$q-}
 {$q-}
-{$endif}
                begin
                begin
                  { avoid problems with broken x86 shifts }
                  { avoid problems with broken x86 shifts }
                  case tcgsize2size[tabstractnormalvarsym(p).initialloc.size] of
                  case tcgsize2size[tabstractnormalvarsym(p).initialloc.size] of
@@ -1399,10 +1400,7 @@ implementation
                      internalerror(2010060801);
                      internalerror(2010060801);
                  end;
                  end;
                end;
                end;
-{$ifdef overflowon}
-{$undef overflowon}
-{$q+}
-{$endif}
+{$pop}
              LOC_REFERENCE :
              LOC_REFERENCE :
                begin
                begin
                    if ((tsym(p).typ=localvarsym) and
                    if ((tsym(p).typ=localvarsym) and
@@ -1512,7 +1510,7 @@ implementation
         current_asmdata.CurrAsmList:=asmlist;
         current_asmdata.CurrAsmList:=asmlist;
         hp:=cloadnode.create(sym,sym.owner);
         hp:=cloadnode.create(sym,sym.owner);
         if (sym.typ=staticvarsym) and (vo_force_finalize in tstaticvarsym(sym).varoptions) then
         if (sym.typ=staticvarsym) and (vo_force_finalize in tstaticvarsym(sym).varoptions) then
-          include(hp.flags,nf_isinternal_ignoreconst);
+          include(tloadnode(hp).loadnodeflags,loadnf_isinternal_ignoreconst);
         hp:=finalize_data_node(hp);
         hp:=finalize_data_node(hp);
         firstpass(hp);
         firstpass(hp);
         secondpass(hp);
         secondpass(hp);

+ 195 - 31
compiler/ncnv.pas

@@ -62,6 +62,7 @@ interface
           function typecheck_cord_to_pointer : tnode;
           function typecheck_cord_to_pointer : tnode;
           function typecheck_chararray_to_string : tnode;
           function typecheck_chararray_to_string : tnode;
           function typecheck_string_to_chararray : tnode;
           function typecheck_string_to_chararray : tnode;
+          function typecheck_string_to_string : tnode;
           function typecheck_char_to_string : tnode;
           function typecheck_char_to_string : tnode;
           function typecheck_char_to_chararray : tnode;
           function typecheck_char_to_chararray : tnode;
           function typecheck_int_to_real : tnode;
           function typecheck_int_to_real : tnode;
@@ -268,7 +269,12 @@ implementation
           remain too so that not too many/few bits are laoded }
           remain too so that not too many/few bits are laoded }
         if equal_defs(p.resultdef,def) and
         if equal_defs(p.resultdef,def) and
            not is_bitpacked_access(p) then
            not is_bitpacked_access(p) then
-          p.resultdef:=def
+          begin
+            { don't replace encoded string constants to rawbytestring encoding.
+              preserve the codepage }
+            if not (is_rawbytestring(def) and (p.nodetype=stringconstn)) then
+              p.resultdef:=def
+          end
         else
         else
          begin
          begin
            case convtype of
            case convtype of
@@ -597,7 +603,7 @@ implementation
            (p.nodetype=stringconstn) and
            (p.nodetype=stringconstn) and
            { don't cast to AnsiString if already casted to Wide/UnicodeString, issue #18266 }
            { don't cast to AnsiString if already casted to Wide/UnicodeString, issue #18266 }
            (tstringconstnode(p).cst_type in [cst_conststring,cst_shortstring,cst_longstring]) then
            (tstringconstnode(p).cst_type in [cst_conststring,cst_shortstring,cst_longstring]) then
-          p:=ctypeconvnode.create_internal(p,cansistringtype)
+          p:=ctypeconvnode.create_internal(p,getansistringdef)
         else
         else
           case p.resultdef.typ of
           case p.resultdef.typ of
             enumdef :
             enumdef :
@@ -920,6 +926,28 @@ implementation
             addstatement(newstat,ctemprefnode.create(restemp));
             addstatement(newstat,ctemprefnode.create(restemp));
             result:=newblock;
             result:=newblock;
           end
           end
+        else if (tstringdef(resultdef).stringtype=st_ansistring) then
+          begin
+            result:=ccallnode.createinternres(
+                      'fpc_'+chartype+'array_to_'+tstringdef(resultdef).stringtypname,
+                      ccallparanode.create(
+                        cordconstnode.create(
+                          ord(tarraydef(left.resultdef).lowrange=0),
+                          pasbool8type,
+                          false
+                        ),
+                        ccallparanode.create(
+                          cordconstnode.create(
+                            getparaencoding(resultdef),
+                            u16inttype,
+                            true
+                          ),
+                          ccallparanode.create(left,nil)
+                        )
+                      ),
+                      resultdef
+                    );
+          end
         else
         else
           result:=ccallnode.createinternres(
           result:=ccallnode.createinternres(
             'fpc_'+chartype+'array_to_'+tstringdef(resultdef).stringtypname,
             'fpc_'+chartype+'array_to_'+tstringdef(resultdef).stringtypname,
@@ -971,7 +999,7 @@ implementation
              else
              else
                begin
                begin
                  if tstringconstnode(left).len>255 then
                  if tstringconstnode(left).len>255 then
-                   inserttypeconv(left,cansistringtype)
+                   inserttypeconv(left,getansistringdef)
                  else
                  else
                    inserttypeconv(left,cshortstringtype);
                    inserttypeconv(left,cshortstringtype);
                end;
                end;
@@ -1002,16 +1030,14 @@ implementation
         newblock : tblocknode;
         newblock : tblocknode;
         newstat  : tstatementnode;
         newstat  : tstatementnode;
         restemp  : ttempcreatenode;
         restemp  : ttempcreatenode;
+        sa : ansistring;
+        cw : tcompilerwidechar;
+        l : SizeUInt;
       begin
       begin
          result:=nil;
          result:=nil;
-         { we can't do widechar to ansichar conversions at compile time, since }
-         { this maps all non-ascii chars to '?' -> loses information           }
-
          if (left.nodetype=ordconstn) and
          if (left.nodetype=ordconstn) and
-            ((tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring]) or
-             (torddef(left.resultdef).ordtype=uchar) or
-             { widechar >=128 is destroyed }
-             (tordconstnode(left).value.uvalue<128)) then
+            ((tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring,st_ansistring]) or
+             (torddef(left.resultdef).ordtype in [uchar,uwidechar])) then
            begin
            begin
               if (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring]) then
               if (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring]) then
                begin
                begin
@@ -1027,35 +1053,75 @@ implementation
               else
               else
                 begin
                 begin
                   if (torddef(left.resultdef).ordtype=uwidechar) then
                   if (torddef(left.resultdef).ordtype=uwidechar) then
-                    hp:=cstringconstnode.createstr(unicode2asciichar(tcompilerwidechar(tordconstnode(left).value.uvalue)))
+                    begin
+                      if (current_settings.sourcecodepage<>CP_UTF8) then
+                        begin
+                          if tordconstnode(left).value.uvalue>127 then
+                            Message(type_w_unicode_data_loss);
+                          hp:=cstringconstnode.createstr(unicode2asciichar(tcompilerwidechar(tordconstnode(left).value.uvalue)));
+                        end
+                      else
+                        begin
+                          cw:=tcompilerwidechar(tordconstnode(left).value.uvalue);
+                          SetLength(sa,5);
+                          l:=UnicodeToUtf8(@(sa[1]),Length(sa),@cw,1);
+                          SetLength(sa,l-1);
+                          hp:=cstringconstnode.createstr(sa);
+                        end
+                    end
                   else
                   else
                     hp:=cstringconstnode.createstr(chr(tordconstnode(left).value.uvalue));
                     hp:=cstringconstnode.createstr(chr(tordconstnode(left).value.uvalue));
-                  tstringconstnode(hp).changestringtype(resultdef);
+                  { output string consts in local ansistring encoding }
+                  if is_ansistring(resultdef) and ((tstringdef(resultdef).encoding=0) or (tstringdef(resultdef).encoding=globals.CP_NONE)) then
+                    tstringconstnode(hp).changestringtype(getansistringdef)
+                  else
+                    tstringconstnode(hp).changestringtype(resultdef);
                 end;
                 end;
               result:=hp;
               result:=hp;
            end
            end
          else
          else
            { shortstrings are handled 'inline' (except for widechars) }
            { shortstrings are handled 'inline' (except for widechars) }
-           if (tstringdef(resultdef).stringtype <> st_shortstring) or
-              (torddef(left.resultdef).ordtype = uwidechar) then
+           if (tstringdef(resultdef).stringtype<>st_shortstring) or
+              (torddef(left.resultdef).ordtype=uwidechar) then
              begin
              begin
-               if (tstringdef(resultdef).stringtype <> st_shortstring) then
+               if (tstringdef(resultdef).stringtype<>st_shortstring) then
                  begin
                  begin
+                   { parameter }
+                   para:=ccallparanode.create(left,nil);
+                   { encoding required? }
+                   if tstringdef(resultdef).stringtype=st_ansistring then
+                     para:=ccallparanode.create(cordconstnode.create(getparaencoding(resultdef),u16inttype,true),para);
+
                    { create the procname }
                    { create the procname }
                    if torddef(left.resultdef).ordtype<>uwidechar then
                    if torddef(left.resultdef).ordtype<>uwidechar then
-                     procname := 'fpc_char_to_'
+                     begin
+                       procname:='fpc_char_to_';
+                       if tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring] then
+                         if nf_explicit in flags then
+                           Message2(type_w_explicit_string_cast,left.resultdef.typename,resultdef.typename)
+                         else
+                           Message2(type_w_implicit_string_cast,left.resultdef.typename,resultdef.typename);
+                     end
                    else
                    else
-                     procname := 'fpc_uchar_to_';
+                     begin
+                       procname:='fpc_uchar_to_';
+                       if not (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring]) then
+                         if nf_explicit in flags then
+                           Message2(type_w_explicit_string_cast_loss,left.resultdef.typename,resultdef.typename)
+                         else
+                           Message2(type_w_implicit_string_cast_loss,left.resultdef.typename,resultdef.typename);
+                     end;
                    procname:=procname+tstringdef(resultdef).stringtypname;
                    procname:=procname+tstringdef(resultdef).stringtypname;
 
 
-                   { and the parameter }
-                   para := ccallparanode.create(left,nil);
-
                    { and finally the call }
                    { and finally the call }
-                   result := ccallnode.createinternres(procname,para,resultdef);
+                   result:=ccallnode.createinternres(procname,para,resultdef);
                  end
                  end
                else
                else
                  begin
                  begin
+                   if nf_explicit in flags then
+                     Message2(type_w_explicit_string_cast_loss,left.resultdef.typename,resultdef.typename)
+                   else
+                     Message2(type_w_implicit_string_cast_loss,left.resultdef.typename,resultdef.typename);
                    newblock:=internalstatements(newstat);
                    newblock:=internalstatements(newstat);
                    restemp:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,false);
                    restemp:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,false);
                    addstatement(newstat,restemp);
                    addstatement(newstat,restemp);
@@ -1084,6 +1150,66 @@ implementation
              end;
              end;
       end;
       end;
 
 
+    function ttypeconvnode.typecheck_string_to_string : tnode;
+      begin
+        result:=nil;
+        if (left.nodetype=stringconstn) and
+           (((tstringdef(resultdef).stringtype=st_ansistring) and
+             (tstringdef(resultdef).encoding<>CP_NONE)
+            )
+           ) and
+           (tstringdef(left.resultdef).stringtype in [st_unicodestring,st_widestring]) then
+          begin
+            tstringconstnode(left).changestringtype(resultdef);
+            Result:=left;
+            left:=nil;
+          end
+        else if (tstringdef(resultdef).stringtype=st_ansistring) and
+                (tstringdef(left.resultdef).stringtype=st_ansistring) and
+                (tstringdef(resultdef).encoding<>tstringdef(left.resultdef).encoding) then
+          begin
+            result:=ccallnode.createinternres(
+                      'fpc_ansistr_to_ansistr',
+                      ccallparanode.create(
+                        cordconstnode.create(
+                          tstringdef(resultdef).encoding,
+                          u16inttype,
+                          true
+                        ),
+                        ccallparanode.create(left,nil)
+                      ),
+                      resultdef
+                    );
+            left:=nil;
+          end
+        else if (left.nodetype=stringconstn) and
+                (tstringdef(left.resultdef).stringtype in [st_unicodestring,st_widestring]) and
+                (tstringdef(resultdef).stringtype=st_shortstring) then
+          begin
+            if not hasnonasciichars(pcompilerwidestring(tstringconstnode(left).value_str)) then
+              begin
+                tstringconstnode(left).changestringtype(resultdef);
+                Result:=left;
+                left:=nil;
+              end;
+          end
+        else if (tstringdef(left.resultdef).stringtype in [st_unicodestring,st_widestring]) and
+                not (tstringdef(resultdef).stringtype in [st_unicodestring,st_widestring]) then
+          begin
+            if nf_explicit in flags then
+              Message2(type_w_explicit_string_cast_loss,left.resultdef.typename,resultdef.typename)
+            else
+              Message2(type_w_implicit_string_cast_loss,left.resultdef.typename,resultdef.typename);
+          end
+        else if not (tstringdef(left.resultdef).stringtype in [st_unicodestring,st_widestring]) and
+                (tstringdef(resultdef).stringtype in [st_unicodestring,st_widestring]) then
+          begin
+            if nf_explicit in flags then
+              Message2(type_w_explicit_string_cast,left.resultdef.typename,resultdef.typename)
+            else
+              Message2(type_w_implicit_string_cast,left.resultdef.typename,resultdef.typename);
+          end
+      end;
 
 
     function ttypeconvnode.typecheck_char_to_chararray : tnode;
     function ttypeconvnode.typecheck_char_to_chararray : tnode;
       begin
       begin
@@ -1108,12 +1234,15 @@ implementation
          if (left.nodetype=ordconstn) and
          if (left.nodetype=ordconstn) and
             ((torddef(resultdef).ordtype<>uchar) or
             ((torddef(resultdef).ordtype<>uchar) or
              (torddef(left.resultdef).ordtype<>uwidechar) or
              (torddef(left.resultdef).ordtype<>uwidechar) or
-             { >= 128 is replaced by '?' currently -> loses information }
-             (tordconstnode(left).value.uvalue<128)) then
+             (current_settings.sourcecodepage<>CP_UTF8))
+         then
            begin
            begin
              if (torddef(resultdef).ordtype=uchar) and
              if (torddef(resultdef).ordtype=uchar) and
-                (torddef(left.resultdef).ordtype=uwidechar) then
+                (torddef(left.resultdef).ordtype=uwidechar) and
+                (current_settings.sourcecodepage<>CP_UTF8) then
               begin
               begin
+                if tordconstnode(left).value.uvalue>127 then
+                  Message(type_w_unicode_data_loss);
                 hp:=cordconstnode.create(
                 hp:=cordconstnode.create(
                       ord(unicode2asciichar(tcompilerwidechar(tordconstnode(left).value.uvalue))),
                       ord(unicode2asciichar(tcompilerwidechar(tordconstnode(left).value.uvalue))),
                       cchartype,true);
                       cchartype,true);
@@ -1285,7 +1414,7 @@ implementation
               (is_widestring(left.resultdef) or
               (is_widestring(left.resultdef) or
                is_unicodestring(left.resultdef)) then
                is_unicodestring(left.resultdef)) then
              begin
              begin
-               inserttypeconv(left,cansistringtype);
+               inserttypeconv(left,getansistringdef);
                { the second pass of second_cstring_to_pchar expects a  }
                { the second pass of second_cstring_to_pchar expects a  }
                { strinconstn, but this may become a call to the        }
                { strinconstn, but this may become a call to the        }
                { widestring manager in case left contains "high ascii" }
                { widestring manager in case left contains "high ascii" }
@@ -1364,6 +1493,15 @@ implementation
             addstatement(newstat,ctemprefnode.create(restemp));
             addstatement(newstat,ctemprefnode.create(restemp));
             result:=newblock;
             result:=newblock;
           end
           end
+        else if tstringdef(resultdef).stringtype=st_ansistring then
+          result := ccallnode.createinternres(
+                      'fpc_pchar_to_'+tstringdef(resultdef).stringtypname,
+                      ccallparanode.create(
+                        cordconstnode.create(getparaencoding(resultdef),u16inttype,true),
+                        ccallparanode.create(left,nil)
+                      ),
+                      resultdef
+                    )
         else
         else
           result := ccallnode.createinternres(
           result := ccallnode.createinternres(
             'fpc_pchar_to_'+tstringdef(resultdef).stringtypname,
             'fpc_pchar_to_'+tstringdef(resultdef).stringtypname,
@@ -1426,6 +1564,21 @@ implementation
             addstatement(newstat,ctemprefnode.create(restemp));
             addstatement(newstat,ctemprefnode.create(restemp));
             result:=newblock;
             result:=newblock;
           end
           end
+        else if tstringdef(resultdef).stringtype=st_ansistring then
+          begin
+            result:=ccallnode.createinternres(
+                        'fpc_pwidechar_to_'+tstringdef(resultdef).stringtypname,
+                         ccallparanode.create(
+                           cordconstnode.create(
+                             getparaencoding(resultdef),
+                             u16inttype,
+                             true
+                           ),
+                           ccallparanode.create(left,nil)
+                         ),
+                         resultdef
+                      );
+          end
         else
         else
           result := ccallnode.createinternres(
           result := ccallnode.createinternres(
             'fpc_pwidechar_to_'+tstringdef(resultdef).stringtypname,
             'fpc_pwidechar_to_'+tstringdef(resultdef).stringtypname,
@@ -1634,7 +1787,7 @@ implementation
           {none} nil,
           {none} nil,
           {equal} nil,
           {equal} nil,
           {not_possible} nil,
           {not_possible} nil,
-          { string_2_string } nil,
+          { string_2_string } @ttypeconvnode.typecheck_string_to_string,
           { char_2_string } @ttypeconvnode.typecheck_char_to_string,
           { char_2_string } @ttypeconvnode.typecheck_char_to_string,
           { char_2_chararray } @ttypeconvnode.typecheck_char_to_chararray,
           { char_2_chararray } @ttypeconvnode.typecheck_char_to_chararray,
           { pchar_2_string } @ttypeconvnode.typecheck_pchar_to_string,
           { pchar_2_string } @ttypeconvnode.typecheck_pchar_to_string,
@@ -2162,13 +2315,17 @@ implementation
               (
               (
                 ((not is_widechararray(left.resultdef) and
                 ((not is_widechararray(left.resultdef) and
                   not is_wide_or_unicode_string(left.resultdef)) or
                   not is_wide_or_unicode_string(left.resultdef)) or
-                 (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring]) or
-                 { non-ascii chars would be replaced with '?' -> loses info }
-                 not hasnonasciichars(pcompilerwidestring(tstringconstnode(left).value_str)))
+                 (tstringdef(resultdef).stringtype in [st_widestring,st_unicodestring,st_ansistring])
+                )
               ) then
               ) then
               begin
               begin
-                tstringconstnode(left).changestringtype(resultdef);
+                { output string consts in local ansistring encoding }
+                if is_ansistring(resultdef) and ((tstringdef(resultdef).encoding=0)or(tstringdef(resultdef).encoding=globals.CP_NONE)) then
+                  tstringconstnode(left).changestringtype(getansistringdef)
+                else
+                  tstringconstnode(left).changestringtype(resultdef);
                 result:=left;
                 result:=left;
+                resultdef:=left.resultdef;
                 left:=nil;
                 left:=nil;
                 exit;
                 exit;
               end;
               end;
@@ -2871,8 +3028,15 @@ implementation
             addstatement(newstat,ctemprefnode.create(restemp));
             addstatement(newstat,ctemprefnode.create(restemp));
             result:=newblock;
             result:=newblock;
           end
           end
+        { encoding parameter required? }
+        else if (tstringdef(resultdef).stringtype=st_ansistring) and
+                (tstringdef(left.resultdef).stringtype in [st_widestring,st_unicodestring,st_shortstring,st_ansistring]) then
+            result:=ccallnode.createinternres(procname,
+              ccallparanode.create(cordconstnode.create(getparaencoding(resultdef),u16inttype,true),
+              ccallparanode.create(left,nil)),resultdef)
         else
         else
-          result := ccallnode.createinternres(procname,ccallparanode.create(left,nil),resultdef);
+          result:=ccallnode.createinternres(procname,ccallparanode.create(left,nil),resultdef);
+
         left:=nil;
         left:=nil;
       end;
       end;
 
 

+ 92 - 7
compiler/ncon.pas

@@ -926,7 +926,7 @@ implementation
           cst_shortstring :
           cst_shortstring :
             resultdef:=cshortstringtype;
             resultdef:=cshortstringtype;
           cst_ansistring :
           cst_ansistring :
-            resultdef:=cansistringtype;
+            resultdef:=getansistringdef;
           cst_unicodestring :
           cst_unicodestring :
             resultdef:=cunicodestringtype;
             resultdef:=cunicodestringtype;
           cst_widestring :
           cst_widestring :
@@ -982,6 +982,9 @@ implementation
       var
       var
         pw : pcompilerwidestring;
         pw : pcompilerwidestring;
         pc : pchar;
         pc : pchar;
+        cp1 : tstringencoding;
+        cp2 : tstringencoding;
+        l,l2 : longint;
       begin
       begin
         if def.typ<>stringdef then
         if def.typ<>stringdef then
           internalerror(200510011);
           internalerror(200510011);
@@ -990,7 +993,7 @@ implementation
            not(cst_type in [cst_widestring,cst_unicodestring]) then
            not(cst_type in [cst_widestring,cst_unicodestring]) then
           begin
           begin
             initwidestring(pw);
             initwidestring(pw);
-            ascii2unicode(value_str,len,pw);
+            ascii2unicode(value_str,len,current_settings.sourcecodepage,pw);
             ansistringdispose(value_str,len);
             ansistringdispose(value_str,len);
             pcompilerwidestring(value_str):=pw;
             pcompilerwidestring(value_str):=pw;
           end
           end
@@ -999,11 +1002,93 @@ implementation
           if (cst_type in [cst_widestring,cst_unicodestring]) and
           if (cst_type in [cst_widestring,cst_unicodestring]) and
             not(tstringdef(def).stringtype in [st_widestring,st_unicodestring]) then
             not(tstringdef(def).stringtype in [st_widestring,st_unicodestring]) then
             begin
             begin
-              pw:=pcompilerwidestring(value_str);
-              getmem(pc,getlengthwidestring(pw)+1);
-              unicode2ascii(pw,pc);
-              donewidestring(pw);
-              value_str:=pc;
+              cp1:=tstringdef(def).encoding;
+              if (cp1=CP_NONE) or (cp1=0) then
+                cp1:=current_settings.sourcecodepage;
+              if (cp1=CP_UTF8) then
+                begin
+                  pw:=pcompilerwidestring(value_str);
+                  l2:=len;
+                  l:=UnicodeToUtf8(nil,0,PUnicodeChar(pw^.data),l2);
+                  getmem(pc,l);   
+                  UnicodeToUtf8(pc,l,PUnicodeChar(pw^.data),l2);
+                  len:=l-1;
+                  donewidestring(pw);
+                  value_str:=pc;
+                end
+              else
+                begin
+                  pw:=pcompilerwidestring(value_str);
+                  getmem(pc,getlengthwidestring(pw)+1);
+                  unicode2ascii(pw,pc,cp1);
+                  donewidestring(pw);
+                  value_str:=pc;
+                end;
+            end
+        else 
+          if (tstringdef(def).stringtype = st_ansistring) and
+             not(cst_type in [cst_widestring,cst_unicodestring]) then
+            begin
+              cp1:=tstringdef(def).encoding;
+              if cp1=0 then
+                cp1:=current_settings.sourcecodepage;
+              if (cst_type = cst_ansistring) then
+                begin
+                  cp2:=tstringdef(resultdef).encoding;
+                  if cp2=0 then
+                    cp2:=current_settings.sourcecodepage;
+                end
+              else if (cst_type in [cst_shortstring,cst_conststring,cst_longstring]) then
+                cp2:=current_settings.sourcecodepage;
+              { don't change string if codepages are equal or string length is 0 }  
+              if (cp1<>cp2) and (len>0) then
+                begin
+                  if cpavailable(cp1) and cpavailable(cp2) then
+                    changecodepage(value_str,len,cp2,value_str,cp1)
+                  else if (cp1 <> CP_NONE) and (cp2 <> CP_NONE) then
+                    begin
+                      { if source encoding is UTF8 convert using UTF8->UTF16->destination encoding }
+                      if (cp2=CP_UTF8) then
+                        begin
+                          if not cpavailable(cp1) then
+                            Message1(option_code_page_not_available,IntToStr(cp1));
+                          initwidestring(pw);
+                          setlengthwidestring(pw,len);
+                          l:=Utf8ToUnicode(PUnicodeChar(pw^.data),len,value_str,len);
+                          if (l<>getlengthwidestring(pw)) then
+                            begin
+                              setlengthwidestring(pw,l);
+                              ReAllocMem(value_str,l);
+                            end;
+                          unicode2ascii(pw,value_str,cp1);
+                          donewidestring(pw);
+                        end
+                      else
+                      { if destination encoding is UTF8 convert using source encoding->UTF16->UTF8 }
+                      if (cp1=CP_UTF8) then
+                        begin
+                          if not cpavailable(cp2) then
+                            Message1(option_code_page_not_available,IntToStr(cp2));
+                          initwidestring(pw);
+                          setlengthwidestring(pw,len);
+                          ascii2unicode(value_str,len,cp2,pw);
+                          l:=UnicodeToUtf8(nil,0,PUnicodeChar(pw^.data),len);
+                          if l<>len then
+                            ReAllocMem(value_str,l);
+                          len:=l-1;
+                          UnicodeToUtf8(value_str,PUnicodeChar(pw^.data),l);
+                          donewidestring(pw);
+                        end
+                      else
+                        begin
+                          { output error message that encoding is not available for the compiler }
+                          if not cpavailable(cp1) then
+                            Message1(option_code_page_not_available,IntToStr(cp1));
+                          if not cpavailable(cp2) then
+                            Message1(option_code_page_not_available,IntToStr(cp2));
+                        end;
+                    end;
+                end;
             end;
             end;
         cst_type:=st2cst[tstringdef(def).stringtype];
         cst_type:=st2cst[tstringdef(def).stringtype];
         resultdef:=def;
         resultdef:=def;

+ 2 - 0
compiler/nflw.pas

@@ -1985,6 +1985,7 @@ implementation
       begin
       begin
          result:=nil;
          result:=nil;
          include(current_procinfo.flags,pi_do_call);
          include(current_procinfo.flags,pi_do_call);
+         include(current_procinfo.flags,pi_uses_exceptions);
          expectloc:=LOC_VOID;
          expectloc:=LOC_VOID;
          firstpass(left);
          firstpass(left);
          { on statements }
          { on statements }
@@ -2003,6 +2004,7 @@ implementation
     constructor ttryfinallynode.create(l,r:tnode);
     constructor ttryfinallynode.create(l,r:tnode);
       begin
       begin
         inherited create(tryfinallyn,l,r,nil,nil);
         inherited create(tryfinallyn,l,r,nil,nil);
+        include(current_procinfo.flags,pi_uses_exceptions);
         implicitframe:=false;
         implicitframe:=false;
       end;
       end;
 
 

+ 20 - 6
compiler/ninl.pas

@@ -322,6 +322,11 @@ implementation
               procname := procname + 'sint';
               procname := procname + 'sint';
           end;
           end;
 
 
+        { for ansistrings insert the encoding argument }
+        if is_ansistring(dest.resultdef) then
+          newparas:=ccallparanode.create(cordconstnode.create(
+            getparaencoding(dest.resultdef),u16inttype,true),newparas);
+
         { free the errornode we generated in the beginning }
         { free the errornode we generated in the beginning }
         result.free;
         result.free;
         { create the call node, }
         { create the call node, }
@@ -373,7 +378,7 @@ implementation
             if (tstringconstnode(n).len<=255) then
             if (tstringconstnode(n).len<=255) then
               inserttypeconv(n,cshortstringtype)
               inserttypeconv(n,cshortstringtype)
             else
             else
-              inserttypeconv(n,cansistringtype)
+              inserttypeconv(n,getansistringdef)
           else if is_widechararray(n.resultdef) then
           else if is_widechararray(n.resultdef) then
             inserttypeconv(n,cwidestringtype);
             inserttypeconv(n,cwidestringtype);
       end;
       end;
@@ -746,11 +751,15 @@ implementation
                         end;
                         end;
 {                      indexpara.right:=lenpara;}
 {                      indexpara.right:=lenpara;}
                     end;
                     end;
-                  { in case of writing a chararray, add whether it's }
-                  { zero-based                                       }
+                  { in case of writing a chararray, add whether it's zero-based }
                   if para.left.resultdef.typ=arraydef then
                   if para.left.resultdef.typ=arraydef then
                     para := ccallparanode.create(cordconstnode.create(
                     para := ccallparanode.create(cordconstnode.create(
-                      ord(tarraydef(para.left.resultdef).lowrange=0),pasbool8type,false),para);
+                      ord(tarraydef(para.left.resultdef).lowrange=0),pasbool8type,false),para)
+                  else
+                  { in case of reading an ansistring pass a codepage argument }
+                  if do_read and is_ansistring(para.left.resultdef) then
+                    para:=ccallparanode.create(cordconstnode.create(
+                      getparaencoding(para.left.resultdef),u16inttype,true),para);
                   { create the call statement }
                   { create the call statement }
                   addstatement(Tstatementnode(newstatement),
                   addstatement(Tstatementnode(newstatement),
                     ccallnode.createintern(name,para));
                     ccallnode.createintern(name,para));
@@ -958,7 +967,7 @@ implementation
                 { (if you want to optimize to use shortstring, keep in mind that    }
                 { (if you want to optimize to use shortstring, keep in mind that    }
                 {  readstr internally always uses ansistring, and to account for    }
                 {  readstr internally always uses ansistring, and to account for    }
                 {  chararrays with > 255 characters)                                }
                 {  chararrays with > 255 characters)                                }
-                inserttypeconv(filepara.left,cansistringtype);
+                inserttypeconv(filepara.left,getansistringdef);
                 filepara.resultdef:=filepara.left.resultdef;
                 filepara.resultdef:=filepara.left.resultdef;
                 if codegenerror then
                 if codegenerror then
                   exit;
                   exit;
@@ -2261,7 +2270,7 @@ implementation
                   case left.resultdef.typ of
                   case left.resultdef.typ of
                     variantdef:
                     variantdef:
                       begin
                       begin
-                        inserttypeconv(left,cansistringtype);
+                        inserttypeconv(left,getansistringdef);
                       end;
                       end;
 
 
                     stringdef :
                     stringdef :
@@ -3178,6 +3187,11 @@ implementation
 
 
      function tinlinenode.first_sqr_real : tnode;
      function tinlinenode.first_sqr_real : tnode;
       begin
       begin
+{$ifndef cpufpemu}
+        { this procedure might be only used for cpus definining cpufpemu else
+          the optimizer might go into an endless loop when doing x*x -> changes }
+        internalerror(2011092401);
+{$endif cpufpemu}
         { create the call to the helper }
         { create the call to the helper }
         { on entry left node contains the parameter }
         { on entry left node contains the parameter }
         first_sqr_real := ctypeconvnode.create(ccallnode.createintern('fpc_sqr_real',
         first_sqr_real := ctypeconvnode.create(ccallnode.createintern('fpc_sqr_real',

+ 28 - 5
compiler/nld.pas

@@ -33,13 +33,24 @@ interface
        symconst,symbase,symtype,symsym,symdef;
        symconst,symbase,symtype,symsym,symdef;
 
 
     type
     type
-       Trttidatatype=(rdt_normal,rdt_ord2str,rdt_str2ord);
+       Trttidatatype = (rdt_normal,rdt_ord2str,rdt_str2ord);
+
+       tloadnodeflags = (
+         loadnf_is_self,
+         loadnf_load_self_pointer,
+         loadnf_inherited,
+         { the loadnode is generated internally and a varspez=vs_const should be ignore,
+           this requires that the parameter is actually passed by value
+           Be really carefull when using this flag! }
+         loadnf_isinternal_ignoreconst
+        );
 
 
        tloadnode = class(tunarynode)
        tloadnode = class(tunarynode)
        protected
        protected
           fprocdef : tprocdef;
           fprocdef : tprocdef;
           fprocdefderef : tderef;
           fprocdefderef : tderef;
        public
        public
+          loadnodeflags : set of tloadnodeflags;
           symtableentry : tsym;
           symtableentry : tsym;
           symtableentryderef : tderef;
           symtableentryderef : tderef;
           symtable : TSymtable;
           symtable : TSymtable;
@@ -192,6 +203,7 @@ implementation
         ppufile.getderef(symtableentryderef);
         ppufile.getderef(symtableentryderef);
         symtable:=nil;
         symtable:=nil;
         ppufile.getderef(fprocdefderef);
         ppufile.getderef(fprocdefderef);
+        ppufile.getsmallset(loadnodeflags);
       end;
       end;
 
 
 
 
@@ -200,6 +212,7 @@ implementation
         inherited ppuwrite(ppufile);
         inherited ppuwrite(ppufile);
         ppufile.putderef(symtableentryderef);
         ppufile.putderef(symtableentryderef);
         ppufile.putderef(fprocdefderef);
         ppufile.putderef(fprocdefderef);
+        ppufile.putsmallset(loadnodeflags);
       end;
       end;
 
 
 
 
@@ -247,7 +260,7 @@ implementation
         result:=(symtable.symtabletype=parasymtable) and
         result:=(symtable.symtabletype=parasymtable) and
                 (symtableentry.typ=paravarsym) and
                 (symtableentry.typ=paravarsym) and
                 not(vo_has_local_copy in tparavarsym(symtableentry).varoptions) and
                 not(vo_has_local_copy in tparavarsym(symtableentry).varoptions) and
-                not(nf_load_self_pointer in flags) and
+                not(loadnf_load_self_pointer in loadnodeflags) and
                 paramanager.push_addr_param(tparavarsym(symtableentry).varspez,tparavarsym(symtableentry).vardef,tprocdef(symtable.defowner).proccalloption);
                 paramanager.push_addr_param(tparavarsym(symtableentry).varspez,tparavarsym(symtableentry).vardef,tprocdef(symtable.defowner).proccalloption);
       end;
       end;
 
 
@@ -261,7 +274,7 @@ implementation
            constsym:
            constsym:
              begin
              begin
                if tconstsym(symtableentry).consttyp=constresourcestring then
                if tconstsym(symtableentry).consttyp=constresourcestring then
-                 resultdef:=cansistringtype
+                 resultdef:=getansistringdef
                else
                else
                  internalerror(22799);
                  internalerror(22799);
              end;
              end;
@@ -311,7 +324,7 @@ implementation
                       (po_staticmethod in tprocdef(symtableentry.owner.defowner).procoptions) then
                       (po_staticmethod in tprocdef(symtableentry.owner.defowner).procoptions) then
                      resultdef:=tclassrefdef.create(resultdef)
                      resultdef:=tclassrefdef.create(resultdef)
                    else if (is_object(resultdef) or is_record(resultdef)) and
                    else if (is_object(resultdef) or is_record(resultdef)) and
-                           (nf_load_self_pointer in flags) then
+                           (loadnf_load_self_pointer in loadnodeflags) then
                      resultdef:=tpointerdef.create(resultdef);
                      resultdef:=tpointerdef.create(resultdef);
                  end
                  end
                else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then
                else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then
@@ -518,6 +531,7 @@ implementation
       var
       var
         hp : tnode;
         hp : tnode;
         useshelper : boolean;
         useshelper : boolean;
+        oldassignmentnode : tassignmentnode;
       begin
       begin
         result:=nil;
         result:=nil;
         resultdef:=voidtype;
         resultdef:=voidtype;
@@ -526,7 +540,14 @@ implementation
         set_unique(left);
         set_unique(left);
 
 
         typecheckpass(left);
         typecheckpass(left);
+
+        { PI. This is needed to return correct resultdef of add nodes for ansistrings
+          rawbytestring return needs to be replaced by left.resultdef }
+        oldassignmentnode:=aktassignmentnode;
+        aktassignmentnode:=self;
         typecheckpass(right);
         typecheckpass(right);
+        aktassignmentnode:=oldassignmentnode;
+
         set_varstate(right,vs_read,[vsf_must_be_valid]);
         set_varstate(right,vs_read,[vsf_must_be_valid]);
         set_varstate(left,vs_written,[]);
         set_varstate(left,vs_written,[]);
         if codegenerror then
         if codegenerror then
@@ -589,7 +610,9 @@ implementation
                   if (right.nodetype=stringconstn) and
                   if (right.nodetype=stringconstn) and
                      (tstringconstnode(right).len=0) then
                      (tstringconstnode(right).len=0) then
                     useshelper:=false;
                     useshelper:=false;
-                end;
+                end
+              else if (tstringdef(right.resultdef).stringtype in [st_unicodestring,st_widestring]) then
+                Message2(type_w_implicit_string_cast_loss,right.resultdef.typename,left.resultdef.typename);
              { rest is done in pass 1 (JM) }
              { rest is done in pass 1 (JM) }
              if useshelper then
              if useshelper then
                exit;
                exit;

+ 63 - 4
compiler/nmat.pas

@@ -102,7 +102,7 @@ implementation
       defutil,
       defutil,
       htypechk,pass_1,
       htypechk,pass_1,
       cgbase,
       cgbase,
-      ncon,ncnv,ncal,nadd,
+      ncon,ncnv,ncal,nadd,nld,nbas,nflw,
       nutils;
       nutils;
 
 
 {****************************************************************************
 {****************************************************************************
@@ -117,7 +117,8 @@ implementation
 
 
         if is_constintnode(right) then
         if is_constintnode(right) then
           begin
           begin
-            if tordconstnode(right).value = 1 then
+            rv:=tordconstnode(right).value;
+            if rv = 1 then
               begin
               begin
                 case nodetype of
                 case nodetype of
                   modn:
                   modn:
@@ -127,12 +128,19 @@ implementation
                 end;
                 end;
                 exit;
                 exit;
               end;
               end;
-            if tordconstnode(right).value = 0 then
+            if rv = 0 then
               begin
               begin
                 Message(parser_e_division_by_zero);
                 Message(parser_e_division_by_zero);
                 { recover }
                 { recover }
                 tordconstnode(right).value := 1;
                 tordconstnode(right).value := 1;
               end;
               end;
+            if (nf_isomod in flags) and
+              (rv<=0) then
+               begin
+                 Message(cg_e_mod_only_defined_for_pos_quotient);
+                 { recover }
+                 tordconstnode(right).value := 1;
+               end;
           end;
           end;
 
 
         if is_constintnode(right) and is_constintnode(left) then
         if is_constintnode(right) and is_constintnode(left) then
@@ -142,7 +150,18 @@ implementation
 
 
             case nodetype of
             case nodetype of
               modn:
               modn:
-                result:=create_simplified_ord_const(lv mod rv,resultdef,forinline);
+                if nf_isomod in flags then
+                  begin
+                    if lv>=0 then
+                      result:=create_simplified_ord_const(lv mod rv,resultdef,forinline)
+                    else
+                      if ((-lv) mod rv)=0 then
+                        result:=create_simplified_ord_const((-lv) mod rv,resultdef,forinline)
+                      else
+                        result:=create_simplified_ord_const(rv-((-lv) mod rv),resultdef,forinline);
+                  end
+                else
+                  result:=create_simplified_ord_const(lv mod rv,resultdef,forinline);
               divn:
               divn:
                 result:=create_simplified_ord_const(lv div rv,resultdef,forinline);
                 result:=create_simplified_ord_const(lv div rv,resultdef,forinline);
             end;
             end;
@@ -152,8 +171,12 @@ implementation
 
 
     function tmoddivnode.pass_typecheck:tnode;
     function tmoddivnode.pass_typecheck:tnode;
       var
       var
+        else_block,
         hp,t : tnode;
         hp,t : tnode;
         rd,ld : torddef;
         rd,ld : torddef;
+        else_statements,
+        statements : tstatementnode;
+        result_data : ttempcreatenode;
       begin
       begin
          result:=nil;
          result:=nil;
          typecheckpass(left);
          typecheckpass(left);
@@ -287,6 +310,42 @@ implementation
             include(hp.flags,nf_is_currency);
             include(hp.flags,nf_is_currency);
             result:=hp;
             result:=hp;
           end;
           end;
+
+         if (nodetype=modn) and (nf_isomod in flags) then
+           begin
+             result:=internalstatements(statements);
+             else_block:=internalstatements(else_statements);
+             result_data:=ctempcreatenode.create(resultdef,resultdef.size,tt_persistent,true);
+
+             { right <=0? }
+             addstatement(statements,cifnode.create(caddnode.create(lten,right.getcopy,cordconstnode.create(0,resultdef,false)),
+               { then: result:=left mod right }
+               ccallnode.createintern('fpc_divbyzero',nil),
+               nil
+               ));
+
+             { prepare else block }
+             { result:=(-left) mod right }
+             addstatement(else_statements,cassignmentnode.create(ctemprefnode.create(result_data),cmoddivnode.create(modn,cunaryminusnode.create(left.getcopy),right.getcopy)));
+             { result<>0? }
+             addstatement(else_statements,cifnode.create(caddnode.create(unequaln,ctemprefnode.create(result_data),cordconstnode.create(0,resultdef,false)),
+               { then: result:=right-result }
+               cassignmentnode.create(ctemprefnode.create(result_data),caddnode.create(subn,right.getcopy,ctemprefnode.create(result_data))),
+               nil
+               ));
+
+             addstatement(statements,result_data);
+             { if left>=0 }
+             addstatement(statements,cifnode.create(caddnode.create(gten,left.getcopy,cordconstnode.create(0,resultdef,false)),
+               { then: result:=left mod right }
+               cassignmentnode.create(ctemprefnode.create(result_data),cmoddivnode.create(modn,left.getcopy,right.getcopy)),
+               { else block }
+               else_block
+               ));
+
+             addstatement(statements,ctempdeletenode.create_normal_temp(result_data));
+             addstatement(statements,ctemprefnode.create(result_data));
+           end;
       end;
       end;
 
 
 
 

+ 1 - 1
compiler/nmem.pas

@@ -782,7 +782,7 @@ implementation
             (tstringconstnode(left).cst_type=cst_conststring) then
             (tstringconstnode(left).cst_type=cst_conststring) then
            begin
            begin
              if tstringconstnode(left).len>255 then
              if tstringconstnode(left).len>255 then
-               inserttypeconv(left,cansistringtype)
+               inserttypeconv(left,getansistringdef)
              else
              else
                inserttypeconv(left,cshortstringtype);
                inserttypeconv(left,cshortstringtype);
            end;
            end;

+ 14 - 11
compiler/node.pas

@@ -224,21 +224,17 @@ interface
          nf_memseg,
          nf_memseg,
          nf_callunique,
          nf_callunique,
 
 
-         { tloadnode }
+         { tloadnode/ttypeconvnode }
          nf_absolute,
          nf_absolute,
-         nf_is_self,
-         nf_load_self_pointer,
-         nf_inherited,
-         { the loadnode is generated internally and a varspez=vs_const should be ignore,
-           this requires that the parameter is actually passed by value
-           Be really carefull when using this flag! }
-         nf_isinternal_ignoreconst,
 
 
          { taddnode }
          { taddnode }
          nf_is_currency,
          nf_is_currency,
          nf_has_pointerdiv,
          nf_has_pointerdiv,
          nf_short_bool,
          nf_short_bool,
 
 
+         { tmoddivnode }
+         nf_isomod,
+
          { tassignmentnode }
          { tassignmentnode }
          nf_assign_done_in_right,
          nf_assign_done_in_right,
 
 
@@ -390,7 +386,7 @@ interface
       { this node is the anchestor for all nodes with at least   }
       { this node is the anchestor for all nodes with at least   }
       { one child, you have to use it if you want to use         }
       { one child, you have to use it if you want to use         }
       { true- and current_procinfo.CurrFalseLabel                                     }
       { true- and current_procinfo.CurrFalseLabel                                     }
-      punarynode = ^tunarynode;
+      //punarynode = ^tunarynode;
       tunarynode = class(tnode)
       tunarynode = class(tnode)
          left : tnode;
          left : tnode;
          constructor create(t:tnodetype;l : tnode);
          constructor create(t:tnodetype;l : tnode);
@@ -407,7 +403,7 @@ interface
          procedure printnodedata(var t:text);override;
          procedure printnodedata(var t:text);override;
       end;
       end;
 
 
-      pbinarynode = ^tbinarynode;
+      //pbinarynode = ^tbinarynode;
       tbinarynode = class(tunarynode)
       tbinarynode = class(tunarynode)
          right : tnode;
          right : tnode;
          constructor create(t:tnodetype;l,r : tnode);
          constructor create(t:tnodetype;l,r : tnode);
@@ -426,7 +422,7 @@ interface
          procedure printnodelist(var t:text);
          procedure printnodelist(var t:text);
       end;
       end;
 
 
-      ptertiarynode = ^ttertiarynode;
+      //ptertiarynode = ^ttertiarynode;
       ttertiarynode = class(tbinarynode)
       ttertiarynode = class(tbinarynode)
          third : tnode;
          third : tnode;
          constructor create(_t:tnodetype;l,r,t : tnode);
          constructor create(_t:tnodetype;l,r,t : tnode);
@@ -1295,4 +1291,11 @@ implementation
             right.isequal(tbinopnode(p).left));
             right.isequal(tbinopnode(p).left));
       end;
       end;
 
 
+begin
+{$push}{$warnings off}
+  { taitype should fit into a 4 byte set for speed reasons }
+  if ord(high(tnodeflags))>31 then
+    internalerror(201110301);
+{$pop}
 end.
 end.
+

+ 39 - 9
compiler/nopt.pas

@@ -25,7 +25,7 @@ unit nopt;
 
 
 interface
 interface
 
 
-uses node,nbas,nadd;
+uses node,nbas,nadd,constexp;
 
 
 type
 type
   tsubnodetype = (
   tsubnodetype = (
@@ -309,6 +309,7 @@ var
   newstatement : tstatementnode;
   newstatement : tstatementnode;
   tempnode    : ttempcreatenode;
   tempnode    : ttempcreatenode;
   is_shortstr : boolean;
   is_shortstr : boolean;
+  para : tcallparanode;
 begin
 begin
   arrp:=nil;
   arrp:=nil;
   hp:=p;
   hp:=p;
@@ -338,10 +339,23 @@ begin
      (aktassignmentnode.left.resultdef=p.resultdef) and
      (aktassignmentnode.left.resultdef=p.resultdef) and
      valid_for_var(aktassignmentnode.left,false) then
      valid_for_var(aktassignmentnode.left,false) then
     begin
     begin
-      result:=ccallnode.createintern('fpc_'+
-        tstringdef(p.resultdef).stringtypname+'_concat_multi',
-        ccallparanode.create(arrp,
-        ccallparanode.create(aktassignmentnode.left.getcopy,nil)));
+      para:=ccallparanode.create(
+              arrp,
+              ccallparanode.create(aktassignmentnode.left.getcopy,nil)
+            );
+      if is_ansistring(p.resultdef) then
+        para:=ccallparanode.create(
+                cordconstnode.create(
+                  getparaencoding(p.resultdef),
+                  u16inttype,
+                  true
+                ),
+                para
+              );
+      result:=ccallnode.createintern(
+                'fpc_'+tstringdef(p.resultdef).stringtypname+'_concat_multi',
+                para
+              );
       include(aktassignmentnode.flags,nf_assign_done_in_right);
       include(aktassignmentnode.flags,nf_assign_done_in_right);
     end
     end
   else
   else
@@ -349,10 +363,26 @@ begin
       result:=internalstatements(newstatement);
       result:=internalstatements(newstatement);
       tempnode:=ctempcreatenode.create(p.resultdef,p.resultdef.size,tt_persistent ,true);
       tempnode:=ctempcreatenode.create(p.resultdef,p.resultdef.size,tt_persistent ,true);
       addstatement(newstatement,tempnode);
       addstatement(newstatement,tempnode);
-      addstatement(newstatement,ccallnode.createintern('fpc_'+
-        tstringdef(p.resultdef).stringtypname+'_concat_multi',
-        ccallparanode.create(arrp,
-        ccallparanode.create(ctemprefnode.create(tempnode),nil))));
+      para:=ccallparanode.create(
+              arrp,
+              ccallparanode.create(ctemprefnode.create(tempnode),nil)
+            );
+      if is_ansistring(p.resultdef) then
+        para:=ccallparanode.create(
+                cordconstnode.create(
+                  getparaencoding(p.resultdef),
+                  u16inttype,
+                  true
+                ),
+                para
+              );
+      addstatement(
+        newstatement,
+        ccallnode.createintern(
+          'fpc_'+tstringdef(p.resultdef).stringtypname+'_concat_multi',
+          para
+        )
+      );
       addstatement(newstatement,ctempdeletenode.create_normal_temp(tempnode));
       addstatement(newstatement,ctempdeletenode.create_normal_temp(tempnode));
       addstatement(newstatement,ctemprefnode.create(tempnode));
       addstatement(newstatement,ctemprefnode.create(tempnode));
     end;
     end;

+ 16 - 2
compiler/nutils.pas

@@ -454,7 +454,7 @@ implementation
         if assigned(srsym) then
         if assigned(srsym) then
           begin
           begin
             result:=cloadnode.create(srsym,srsym.owner);
             result:=cloadnode.create(srsym,srsym.owner);
-            include(result.flags,nf_is_self);
+            include(tloadnode(result).loadnodeflags,loadnf_is_self);
           end
           end
         else
         else
           begin
           begin
@@ -491,7 +491,7 @@ implementation
         if assigned(srsym) then
         if assigned(srsym) then
           begin
           begin
             result:=cloadnode.create(srsym,srsym.owner);
             result:=cloadnode.create(srsym,srsym.owner);
-            include(result.flags,nf_load_self_pointer);
+            include(tloadnode(result).loadnodeflags,loadnf_load_self_pointer);
           end
           end
         else
         else
           begin
           begin
@@ -602,6 +602,13 @@ implementation
                cnilnode.create
                cnilnode.create
                );
                );
           end
           end
+        else if (p.resultdef.typ=variantdef) then
+          begin
+            result:=ccallnode.createintern('fpc_variant_init',
+              ccallparanode.create(
+                ctypeconvnode.create_internal(p,search_system_type('TVARDATA').typedef),
+              nil));
+          end
         else
         else
           begin
           begin
             result:=ccallnode.createintern('fpc_initialize',
             result:=ccallnode.createintern('fpc_initialize',
@@ -670,6 +677,13 @@ implementation
                cnilnode.create
                cnilnode.create
                ));
                ));
           end
           end
+        else if p.resultdef.typ=variantdef then
+          begin
+            result:=ccallnode.createintern('fpc_variant_clear',
+              ccallparanode.create(
+                ctypeconvnode.create_internal(p,search_system_type('TVARDATA').typedef),
+              nil));
+          end
         else
         else
           result:=ccallnode.createintern('fpc_finalize',
           result:=ccallnode.createintern('fpc_finalize',
                 ccallparanode.create(
                 ccallparanode.create(

+ 0 - 5
compiler/objcgutl.pas

@@ -133,9 +133,6 @@ function objcaddprotocolentry(const p: shortstring; ref: TAsmSymbol): Boolean;
   var
   var
     item  : PHashSetItem;
     item  : PHashSetItem;
   begin
   begin
-    if current_asmdata.ConstPools[sp_objcprotocolrefs]=nil then
-      current_asmdata.ConstPools[sp_objcprotocolrefs]:=THashSet.Create(64, True, False);
-
     item:=current_asmdata.constpools[sp_objcprotocolrefs].FindOrAdd(@p[1], length(p));
     item:=current_asmdata.constpools[sp_objcprotocolrefs].FindOrAdd(@p[1], length(p));
     Result:=(item^.Data=nil);
     Result:=(item^.Data=nil);
     if Result then
     if Result then
@@ -153,8 +150,6 @@ function objcreatestringpoolentryintern(p: pchar; len: longint; pooltype: tconst
     pc     : pchar;
     pc     : pchar;
     pool   : THashSet;
     pool   : THashSet;
   begin
   begin
-    if current_asmdata.ConstPools[pooltype]=nil then
-       current_asmdata.ConstPools[pooltype]:=THashSet.Create(64, True, False);
     pool := current_asmdata.constpools[pooltype];
     pool := current_asmdata.constpools[pooltype];
 
 
     entry:=pool.FindOrAdd(p,len);
     entry:=pool.FindOrAdd(p,len);

+ 3 - 1
compiler/ogcoff.pas

@@ -1629,6 +1629,8 @@ const pemagic : array[0..3] of byte = (
                rel_type:=RELOC_RVA;
                rel_type:=RELOC_RVA;
              IMAGE_REL_ARM_BRANCH24:
              IMAGE_REL_ARM_BRANCH24:
                rel_type:=RELOC_RELATIVE_24;
                rel_type:=RELOC_RELATIVE_24;
+             IMAGE_REL_ARM_SECREL:
+               rel_type:=RELOC_SECREL32;
 {$endif arm}
 {$endif arm}
 {$ifdef i386}
 {$ifdef i386}
              IMAGE_REL_I386_PCRLONG :
              IMAGE_REL_I386_PCRLONG :
@@ -3018,7 +3020,7 @@ const pemagic : array[0..3] of byte = (
             DLLReader.Seek(sechdr.datapos+expdir.AddrNames-sechdr.rvaofs+i*4);
             DLLReader.Seek(sechdr.datapos+expdir.AddrNames-sechdr.rvaofs+i*4);
             DLLReader.Read(NameOfs,4);
             DLLReader.Read(NameOfs,4);
             Dec(NameOfs,sechdr.rvaofs);
             Dec(NameOfs,sechdr.rvaofs);
-            if (NameOfs<0) or
+            if {(NameOfs<0) or}
                (NameOfs>sechdr.vsize) then
                (NameOfs>sechdr.vsize) then
               begin
               begin
                 Comment(V_Error,'DLL does contains invalid exports');
                 Comment(V_Error,'DLL does contains invalid exports');

+ 10 - 2
compiler/ogelf.pas

@@ -753,13 +753,17 @@ implementation
         if CurrObjSec.sectype in [sec_rodata,sec_bss,sec_threadvar] then
         if CurrObjSec.sectype in [sec_rodata,sec_bss,sec_threadvar] then
           internalerror(200408252);
           internalerror(200408252);
 {$endif userodata}
 {$endif userodata}
+        { Using RELOC_RVA to map 32-bit RELOC_ABSOLUTE to R_X86_64_32
+          (RELOC_ABSOLUTE maps to R_X86_64_32S) }
+        if (reltype=RELOC_ABSOLUTE) and (len<>sizeof(pint)) then
+          reltype:=RELOC_RVA;
         if assigned(p) then
         if assigned(p) then
          begin
          begin
            { real address of the symbol }
            { real address of the symbol }
            symaddr:=p.address;
            symaddr:=p.address;
            { Local ObjSymbols can be resolved already or need a section reloc }
            { Local ObjSymbols can be resolved already or need a section reloc }
            if (p.bind=AB_LOCAL) and
            if (p.bind=AB_LOCAL) and
-              (reltype in [RELOC_RELATIVE,RELOC_ABSOLUTE{$ifdef x86_64},RELOC_ABSOLUTE32{$endif x86_64}]) then
+              (reltype in [RELOC_RELATIVE,RELOC_ABSOLUTE{$ifdef x86_64},RELOC_ABSOLUTE32,RELOC_RVA{$endif x86_64}]) then
              begin
              begin
                { For a reltype relocation in the same section the
                { For a reltype relocation in the same section the
                  value can be calculated }
                  value can be calculated }
@@ -810,8 +814,10 @@ implementation
         relsym,
         relsym,
         reltyp   : longint;
         reltyp   : longint;
         relocsect : TObjSection;
         relocsect : TObjSection;
+{$ifdef x86_64}	
         tmp: aint;
         tmp: aint;
         asize: longint;
         asize: longint;
+{$endif x86_64}	
       begin
       begin
         with elf32data do
         with elf32data do
          begin
          begin
@@ -869,6 +875,8 @@ implementation
                    reltyp:=R_X86_64_64;
                    reltyp:=R_X86_64_64;
                  RELOC_ABSOLUTE32 :
                  RELOC_ABSOLUTE32 :
                    reltyp:=R_X86_64_32S;
                    reltyp:=R_X86_64_32S;
+                 RELOC_RVA :
+                   reltyp:=R_X86_64_32;
                  RELOC_GOTPCREL :
                  RELOC_GOTPCREL :
                    begin
                    begin
                      reltyp:=R_X86_64_GOTPCREL;
                      reltyp:=R_X86_64_GOTPCREL;
@@ -1274,7 +1282,7 @@ implementation
             idtxt  : 'ELF';
             idtxt  : 'ELF';
             asmbin : '';
             asmbin : '';
             asmcmd : '';
             asmcmd : '';
-            supported_targets : [system_x86_64_linux];
+            supported_targets : [system_x86_64_linux,system_x86_64_freebsd];
             flags : [af_outputbinary,af_smartlink_sections,af_supports_dwarf];
             flags : [af_outputbinary,af_smartlink_sections,af_supports_dwarf];
             labelprefix : '.L';
             labelprefix : '.L';
             comment : '';
             comment : '';

+ 3 - 3
compiler/ognlm.pas

@@ -254,9 +254,9 @@ const NLM_MAX_DESCRIPTION_LENGTH = 127;
          nlmVersionHeader   : nlm32_i386_external_version_header;
          nlmVersionHeader   : nlm32_i386_external_version_header;
          nlmExtHeader       : nlm32_i386_external_extended_header;
          nlmExtHeader       : nlm32_i386_external_extended_header;
          nlmCustHeader      : nlm32_i386_external_custom_header;
          nlmCustHeader      : nlm32_i386_external_custom_header;
-         nlmHelpFileName    : TCmdStr;
-         nlmMessagesFileName: TCmdStr;
-         nlmXdcFileName     : TCmdStr;
+         //nlmHelpFileName    : TCmdStr;
+         //nlmMessagesFileName: TCmdStr;
+         //nlmXdcFileName     : TCmdStr;
          nlmCopyright       : string;
          nlmCopyright       : string;
          nlmThreadname      : string;
          nlmThreadname      : string;
          nlmScreenname      : string;
          nlmScreenname      : string;

+ 4 - 4
compiler/optdead.pas

@@ -285,9 +285,9 @@ const
         if not result then
         if not result then
           exit;
           exit;
         cgmessage1(wpo_error_reading_symbol_file,symbolprogfullpath);
         cgmessage1(wpo_error_reading_symbol_file,symbolprogfullpath);
-{$i-}
+{$push}{$i-}
         close(fsymfile);
         close(fsymfile);
-{$i+}
+{$pop}
         if fileexists(fsymfilename) then
         if fileexists(fsymfilename) then
           deletefile(fsymfilename);
           deletefile(fsymfilename);
       end;
       end;
@@ -389,9 +389,9 @@ const
         end;
         end;
 
 
       assign(fsymfile,fsymfilename);
       assign(fsymfile,fsymfilename);
-{$i-}
+{$push}{$i-}
       reset(fsymfile);
       reset(fsymfile);
-{$i+}
+{$pop}
       if failiferror((ioresult<>0) or eof(fsymfile)) then
       if failiferror((ioresult<>0) or eof(fsymfile)) then
         exit;
         exit;
       readln(fsymfile, line);
       readln(fsymfile, line);

+ 40 - 31
compiler/options.pas

@@ -78,7 +78,7 @@ implementation
 
 
 uses
 uses
   widestr,
   widestr,
-  {$ifdef VER2_2}ccharset{$else VER2_2}charset{$endif VER2_2},
+  {$if FPC_FULLVERSION<20700}ccharset{$else}charset{$endif},
   SysUtils,
   SysUtils,
   version,
   version,
   cutils,cmsgs,
   cutils,cmsgs,
@@ -867,11 +867,12 @@ begin
                  'c' :
                  'c' :
                    begin
                    begin
                      if (upper(more)='UTF8') or (upper(more)='UTF-8') then
                      if (upper(more)='UTF8') or (upper(more)='UTF-8') then
-                        init_settings.sourcecodepage:='utf8'
+                       init_settings.sourcecodepage:=CP_UTF8
                      else if not(cpavailable(more)) then
                      else if not(cpavailable(more)) then
                        Message1(option_code_page_not_available,more)
                        Message1(option_code_page_not_available,more)
                      else
                      else
-                       init_settings.sourcecodepage:=more;
+                       init_settings.sourcecodepage:=codepagebyname(more);
+                     include(init_settings.moduleswitches,cs_explicit_codepage);
                    end;
                    end;
                  'C' :
                  'C' :
                    RCCompiler := More;
                    RCCompiler := More;
@@ -903,9 +904,15 @@ begin
                    end;
                    end;
                  'm' :
                  'm' :
                    begin
                    begin
-                     unicodemapping:=loadunicodemapping(More,More+'.txt');
-                     if assigned(unicodemapping) then
-                       registermapping(unicodemapping)
+                     s:=ExtractFileDir(more);
+                     if TryStrToInt(ExtractFileName(more),j) then
+                       begin
+                         unicodemapping:=loadunicodemapping(More,More+'.txt',j);
+                         if assigned(unicodemapping) then
+                           registermapping(unicodemapping)
+                         else
+                           IllegalPara(opt);
+                       end
                      else
                      else
                        IllegalPara(opt);
                        IllegalPara(opt);
                    end;
                    end;
@@ -1883,9 +1890,9 @@ begin
 { open file }
 { open file }
   Message1(option_using_file,filename);
   Message1(option_using_file,filename);
   assign(f,ExpandFileName(filename));
   assign(f,ExpandFileName(filename));
-  {$I-}
+  {$push}{$I-}
    reset(f);
    reset(f);
-  {$I+}
+  {$pop}
   if ioresult<>0 then
   if ioresult<>0 then
    begin
    begin
      Message1(option_unable_open_file,filename);
      Message1(option_unable_open_file,filename);
@@ -2083,24 +2090,25 @@ begin
    begin
    begin
      inc(paramindex);
      inc(paramindex);
      opts:=objpas.paramstr(paramindex);
      opts:=objpas.paramstr(paramindex);
-     case opts[1] of
-       '@' :
-         if not firstpass then
-         begin
-           Delete(opts,1,1);
-           Message1(option_reading_further_from,opts);
-           interpret_file(opts);
-         end;
-       '!' :
-         if not firstpass then
-         begin
-           Delete(opts,1,1);
-           Message1(option_reading_further_from,'(env) '+opts);
-           interpret_envvar(opts);
-         end;
-       else
-         interpret_option(opts,true);
-     end;
+     if length(opts)>0 then
+       case opts[1] of
+         '@' :
+           if not firstpass then
+           begin
+             Delete(opts,1,1);
+             Message1(option_reading_further_from,opts);
+             interpret_file(opts);
+           end;
+         '!' :
+           if not firstpass then
+           begin
+             Delete(opts,1,1);
+             Message1(option_reading_further_from,'(env) '+opts);
+             interpret_envvar(opts);
+           end;
+         else
+           interpret_option(opts,true);
+       end;
    end;
    end;
 end;
 end;
 
 
@@ -2307,7 +2315,7 @@ begin
   if (paratargetdbg in [dbg_dwarf2,dbg_dwarf3]) and
   if (paratargetdbg in [dbg_dwarf2,dbg_dwarf3]) and
      not(target_info.system in systems_darwin) then
      not(target_info.system in systems_darwin) then
     begin
     begin
-      { smartlink creation does not yet work with DWARF 
+      { smartlink creation does not yet work with DWARF
         debug info on most targets, but it works in internal assembler }
         debug info on most targets, but it works in internal assembler }
       if (cs_create_smart in init_settings.moduleswitches) and
       if (cs_create_smart in init_settings.moduleswitches) and
          not (af_outputbinary in target_asm.flags) then
          not (af_outputbinary in target_asm.flags) then
@@ -2493,6 +2501,7 @@ begin
 {$endif}
 {$endif}
   def_system_macro('FPC_HAS_UNICODESTRING');
   def_system_macro('FPC_HAS_UNICODESTRING');
   def_system_macro('FPC_RTTI_PACKSET1');
   def_system_macro('FPC_RTTI_PACKSET1');
+  def_system_macro('FPC_HAS_CPSTRING');
 {$ifdef x86_64}
 {$ifdef x86_64}
   def_system_macro('FPC_HAS_RIP_RELATIVE');
   def_system_macro('FPC_HAS_RIP_RELATIVE');
 {$endif x86_64}
 {$endif x86_64}
@@ -2500,7 +2509,7 @@ begin
   def_system_macro('FPC_HAS_RESSTRINITS');
   def_system_macro('FPC_HAS_RESSTRINITS');
 
 
 { these cpus have an inline rol/ror implementaion }
 { these cpus have an inline rol/ror implementaion }
-{$if defined(x86) or defined(arm) or defined(powerpc) or defined(powerpc64)}
+{$ifdef cpurox}
   def_system_macro('FPC_HAS_INTERNAL_ROX');
   def_system_macro('FPC_HAS_INTERNAL_ROX');
 {$endif}
 {$endif}
 
 
@@ -2868,11 +2877,11 @@ if (target_info.system=system_arm_darwin) then
         def_system_macro('FPC_HAS_TYPE_EXTENDED');
         def_system_macro('FPC_HAS_TYPE_EXTENDED');
 {$endif}
 {$endif}
     end;
     end;
-    { Not ready yet }
-{$ifdef TEST_TLS_DIRECTORY}
+    { Enable now for testing }
+{$ifndef DISABLE_TLS_DIRECTORY}
     if target_info.system in systems_windows then
     if target_info.system in systems_windows then
       def_system_macro('FPC_USE_TLS_DIRECTORY');
       def_system_macro('FPC_USE_TLS_DIRECTORY');
-{$endif TEST_TLS_DIRECTORY}
+{$endif not DISABLE_TLS_DIRECTORY}
 
 
 
 
 {$ifdef ARM}
 {$ifdef ARM}

+ 1 - 1
compiler/opttail.pas

@@ -127,7 +127,7 @@ unit opttail;
 
 
                         { "cast" away const varspezs }
                         { "cast" away const varspezs }
                         loadnode:=cloadnode.create(paranode.parasym,paranode.parasym.owner);
                         loadnode:=cloadnode.create(paranode.parasym,paranode.parasym.owner);
-                        include(loadnode.flags,nf_isinternal_ignoreconst);
+                        include(tloadnode(loadnode).loadnodeflags,loadnf_isinternal_ignoreconst);
 
 
                         addstatement(copystatements,
                         addstatement(copystatements,
                           cassignmentnode.create(
                           cassignmentnode.create(

+ 4 - 1
compiler/paramgr.pas

@@ -238,6 +238,9 @@ implementation
         result:=[];
         result:=[];
       end;
       end;
 
 
+{$if first_mm_imreg = 0}
+  {$WARN 4044 OFF} { Comparison might be always false ... }
+{$endif}
 
 
     procedure tparamanager.allocparaloc(list: TAsmList; const paraloc: pcgparalocation);
     procedure tparamanager.allocparaloc(list: TAsmList; const paraloc: pcgparalocation);
       begin
       begin
@@ -435,7 +438,7 @@ implementation
         p.init_paraloc_info(callbothsides);
         p.init_paraloc_info(callbothsides);
         result:=p.calleeargareasize;
         result:=p.calleeargareasize;
       end;
       end;
-      
+
 
 
     function tparamanager.parseparaloc(parasym: tparavarsym; const s: string): boolean;
     function tparamanager.parseparaloc(parasym: tparavarsym; const s: string): boolean;
       begin
       begin

+ 0 - 1
compiler/parser.pas

@@ -281,7 +281,6 @@ implementation
           old_current_module : tmodule;
           old_current_module : tmodule;
           oldcurrent_procinfo : tprocinfo;
           oldcurrent_procinfo : tprocinfo;
           old_settings : tsettings;
           old_settings : tsettings;
-          oldsourcecodepage : tcodepagestring;
           old_switchesstatestack : tswitchesstatestack;
           old_switchesstatestack : tswitchesstatestack;
           old_switchesstatestackpos : Integer;
           old_switchesstatestackpos : Integer;
         end;
         end;

+ 3 - 1
compiler/pass_2.pas

@@ -35,6 +35,8 @@ uses
          fc_continue,
          fc_continue,
          fc_inflowcontrol,
          fc_inflowcontrol,
          fc_gotolabel,
          fc_gotolabel,
+         { in try block of try..finally }
+         fc_unwind,
          { the left side of an expression is already handled, so we are
          { the left side of an expression is already handled, so we are
            not allowed to do ssl }
            not allowed to do ssl }
          fc_lefthandled);
          fc_lefthandled);
@@ -199,7 +201,7 @@ implementation
             if (not codegenerror) then
             if (not codegenerror) then
              begin
              begin
                if (p.location.loc<>p.expectloc) then
                if (p.location.loc<>p.expectloc) then
-                 Comment(V_Warning,'Location not equal to expectloc: '+nodetype2str[p.nodetype]);
+                 Comment(V_Warning,'Location ('+tcgloc2str[p.location.loc]+') not equal to expectloc ('+tcgloc2str[p.expectloc]+'): '+nodetype2str[p.nodetype]);
                if (p.location.loc=LOC_INVALID) then
                if (p.location.loc=LOC_INVALID) then
                  Comment(V_Warning,'Location not set in secondpass: '+nodetype2str[p.nodetype]);
                  Comment(V_Warning,'Location not set in secondpass: '+nodetype2str[p.nodetype]);
              end;
              end;

+ 23 - 0
compiler/pdecl.pas

@@ -360,6 +360,7 @@ implementation
          generictypelist : TFPObjectList;
          generictypelist : TFPObjectList;
          generictokenbuf : tdynamicarray;
          generictokenbuf : tdynamicarray;
          vmtbuilder : TVMTBuilder;
          vmtbuilder : TVMTBuilder;
+         p:tnode;
          gendef : tstoreddef;
          gendef : tstoreddef;
          s : shortstring;
          s : shortstring;
       begin
       begin
@@ -565,6 +566,28 @@ implementation
 
 
                       hdef:=tstoreddef(hdef).getcopy;
                       hdef:=tstoreddef(hdef).getcopy;
 
 
+                      { check if it is an ansistirng(codepage) declaration }
+                      if is_ansistring(hdef) and try_to_consume(_LKLAMMER) then
+                        begin
+                          p:=comp_expr(true,false);
+                          consume(_RKLAMMER);
+                          if not is_constintnode(p) then
+                            begin
+                              Message(parser_e_illegal_expression);
+                              { error recovery }
+                            end
+                          else
+                            begin
+                              if (tordconstnode(p).value<0) or (tordconstnode(p).value>65535) then
+                                begin
+                                  Message(parser_e_invalid_codepage);
+                                  tordconstnode(p).value:=0;
+                                end;
+                              tstringdef(hdef).encoding:=int64(tordconstnode(p).value);
+                            end;
+                          p.free;
+                        end;
+
                       { fix name, it is used e.g. for tables }
                       { fix name, it is used e.g. for tables }
                       if is_class_or_interface_or_dispinterface(hdef) then
                       if is_class_or_interface_or_dispinterface(hdef) then
                         with tobjectdef(hdef) do
                         with tobjectdef(hdef) do

+ 10 - 4
compiler/pdecobj.pas

@@ -634,10 +634,15 @@ implementation
                         Message1(type_e_record_helper_must_extend_same_record,current_objectdef.childof.extendeddef.typename);
                         Message1(type_e_record_helper_must_extend_same_record,current_objectdef.childof.extendeddef.typename);
                     end;
                     end;
                 end;
                 end;
+              else
+                hdef:=nil;
             end;
             end;
-
-            current_objectdef.extendeddef:=tabstractrecorddef(hdef);
           end;
           end;
+
+        if assigned(hdef) then
+          current_objectdef.extendeddef:=hdef
+        else
+          current_objectdef.extendeddef:=generrordef;
       end;
       end;
 
 
     procedure parse_guid;
     procedure parse_guid;
@@ -1242,7 +1247,8 @@ implementation
         { if this helper is defined in the implementation section of the unit
         { if this helper is defined in the implementation section of the unit
           or inside the main project file, the extendeddefs list of the current
           or inside the main project file, the extendeddefs list of the current
           module must be updated (it will be removed when poping the symtable) }
           module must be updated (it will be removed when poping the symtable) }
-        if is_objectpascal_helper(current_structdef) then
+        if is_objectpascal_helper(current_structdef) and
+            (current_objectdef.extendeddef.typ in [recorddef,objectdef]) then
           begin
           begin
             { the topmost symtable must be a static symtable }
             { the topmost symtable must be a static symtable }
             st:=current_structdef.owner;
             st:=current_structdef.owner;
@@ -1250,7 +1256,7 @@ implementation
               st:=st.defowner.owner;
               st:=st.defowner.owner;
             if st.symtabletype=staticsymtable then
             if st.symtabletype=staticsymtable then
               begin
               begin
-                s:=make_mangledname('',current_objectdef.extendeddef.symtable,'');
+                s:=make_mangledname('',tabstractrecorddef(current_objectdef.extendeddef).symtable,'');
                 list:=TFPObjectList(current_module.extendeddefs.Find(s));
                 list:=TFPObjectList(current_module.extendeddefs.Find(s));
                 if not assigned(list) then
                 if not assigned(list) then
                   begin
                   begin

+ 24 - 7
compiler/pdecsub.pas

@@ -245,7 +245,7 @@ implementation
         storepos : tfileposinfo;
         storepos : tfileposinfo;
         vs       : tparavarsym;
         vs       : tparavarsym;
         hdef     : tdef;
         hdef     : tdef;
-        selfdef  : tabstractrecorddef;
+        selfdef  : tdef;
         vsp      : tvarspez;
         vsp      : tvarspez;
         aliasvs  : tabsolutevarsym;
         aliasvs  : tabsolutevarsym;
         sl       : tpropaccesslist;
         sl       : tpropaccesslist;
@@ -1209,7 +1209,7 @@ implementation
             { Add ObjectSymtable to be able to find nested type definitions }
             { Add ObjectSymtable to be able to find nested type definitions }
             popclass:=0;
             popclass:=0;
             if assigned(pd.struct) and
             if assigned(pd.struct) and
-               (pd.parast.symtablelevel=normal_function_level) and
+               (pd.parast.symtablelevel>=normal_function_level) and
                not(symtablestack.top.symtabletype in [ObjectSymtable,recordsymtable]) then
                not(symtablestack.top.symtabletype in [ObjectSymtable,recordsymtable]) then
               begin
               begin
                 popclass:=push_nested_hierarchy(pd.struct);
                 popclass:=push_nested_hierarchy(pd.struct);
@@ -1263,7 +1263,7 @@ implementation
             { Add ObjectSymtable to be able to find generic type definitions }
             { Add ObjectSymtable to be able to find generic type definitions }
             popclass:=0;
             popclass:=0;
             if assigned(pd.struct) and
             if assigned(pd.struct) and
-               (pd.parast.symtablelevel=normal_function_level) and
+               (pd.parast.symtablelevel>=normal_function_level) and
                not (symtablestack.top.symtabletype in [ObjectSymtable,recordsymtable]) then
                not (symtablestack.top.symtabletype in [ObjectSymtable,recordsymtable]) then
               begin
               begin
                 popclass:=push_nested_hierarchy(pd.struct);
                 popclass:=push_nested_hierarchy(pd.struct);
@@ -1454,7 +1454,10 @@ implementation
                                break;
                                break;
                              end;
                              end;
                          if not found then
                          if not found then
-                           Message1(parser_e_at_least_one_argument_must_be_of_type,pd.struct.RttiName);
+                           if assigned(pd.struct) then
+                             Message1(parser_e_at_least_one_argument_must_be_of_type,pd.struct.RttiName)
+                           else
+                             MessagePos(pd.fileinfo,type_e_type_id_expected);
                        end;
                        end;
                      if (optoken in [_EQ,_NE,_GT,_LT,_GTE,_LTE,_OP_IN]) and
                      if (optoken in [_EQ,_NE,_GT,_LT,_GTE,_LTE,_OP_IN]) and
                         ((pd.returndef.typ<>orddef) or
                         ((pd.returndef.typ<>orddef) or
@@ -2127,7 +2130,7 @@ type
    end;
    end;
 const
 const
   {Should contain the number of procedure directives we support.}
   {Should contain the number of procedure directives we support.}
-  num_proc_directives=42;
+  num_proc_directives=43;
   proc_direcdata:array[1..num_proc_directives] of proc_dir_rec=
   proc_direcdata:array[1..num_proc_directives] of proc_dir_rec=
    (
    (
     (
     (
@@ -2520,6 +2523,15 @@ const
       mutexclpocall : [pocall_internproc];
       mutexclpocall : [pocall_internproc];
       mutexclpotype : [];
       mutexclpotype : [];
       mutexclpo     : [po_exports,po_interrupt,po_external,po_inline]
       mutexclpo     : [po_exports,po_interrupt,po_external,po_inline]
+    ),(
+      idtok:_RTLPROC;
+      pd_flags : [pd_interface,pd_implemen,pd_body,pd_notobjintf];
+      handler  : nil;
+      pocall   : pocall_none;
+      pooption : [po_rtlproc];
+      mutexclpocall : [];
+      mutexclpotype : [potype_constructor,potype_destructor,potype_class_constructor,potype_class_destructor];
+      mutexclpo     : [po_interrupt]
     )
     )
    );
    );
 
 
@@ -3193,7 +3205,12 @@ const
                      po_comp:=[po_classmethod,po_methodpointer];
                      po_comp:=[po_classmethod,po_methodpointer];
 
 
                    if ((po_comp * fwpd.procoptions)<>(po_comp * currpd.procoptions)) or
                    if ((po_comp * fwpd.procoptions)<>(po_comp * currpd.procoptions)) or
-                      (fwpd.proctypeoption <> currpd.proctypeoption) then
+                      (fwpd.proctypeoption <> currpd.proctypeoption) or
+                      { if the implementation version has an "overload" modifier,
+                        the interface version must also have it (otherwise we can
+                        get annoying crashes due to interface crc changes) }
+                      (not(po_overload in fwpd.procoptions) and
+                       (po_overload in currpd.procoptions)) then
                      begin
                      begin
                        MessagePos1(currpd.fileinfo,parser_e_header_dont_match_forward,
                        MessagePos1(currpd.fileinfo,parser_e_header_dont_match_forward,
                                    fwpd.fullprocname(false));
                                    fwpd.fullprocname(false));
@@ -3333,7 +3350,7 @@ const
                   begin
                   begin
                     MessagePos1(currpd.fileinfo,parser_e_no_overload_for_all_procs,currpd.procsym.realname);
                     MessagePos1(currpd.fileinfo,parser_e_no_overload_for_all_procs,currpd.procsym.realname);
                     break;
                     break;
-                  end;
+                  end
                end
                end
               else
               else
                begin
                begin

+ 31 - 12
compiler/pdecvar.pas

@@ -318,6 +318,21 @@ implementation
                 end;
                 end;
             end;
             end;
 
 
+          procedure add_parameters(p: tpropertysym; readprocdef, writeprocdef: tprocdef);
+            var
+              i: integer;
+              orig, hparavs: tparavarsym;
+            begin
+              for i := 0 to p.parast.SymList.Count - 1 do
+                begin
+                  orig:=tparavarsym(p.parast.SymList[i]);
+                  hparavs:=tparavarsym.create(orig.RealName,orig.paranr,orig.varspez,orig.vardef,[]);
+                  readprocdef.parast.insert(hparavs);
+                  hparavs:=tparavarsym.create(orig.RealName,orig.paranr,orig.varspez,orig.vardef,[]);
+                  writeprocdef.parast.insert(hparavs);
+                end;
+            end;
+
           procedure add_index_parameter(var paranr: word; p: tpropertysym; readprocdef, writeprocdef: tprocdef);
           procedure add_index_parameter(var paranr: word; p: tpropertysym; readprocdef, writeprocdef: tprocdef);
             var
             var
               hparavs: tparavarsym;
               hparavs: tparavarsym;
@@ -386,7 +401,8 @@ implementation
                 not (m_delphi in current_settings.modeswitches) then
                 not (m_delphi in current_settings.modeswitches) then
                 Message(parser_e_cant_publish_that_property);
                 Message(parser_e_cant_publish_that_property);
               { create a list of the parameters }
               { create a list of the parameters }
-              symtablestack.push(readprocdef.parast);
+              p.parast:=tparasymtable.create(nil,0);
+              symtablestack.push(p.parast);
               sc:=TFPObjectList.create(false);
               sc:=TFPObjectList.create(false);
               repeat
               repeat
                 if try_to_consume(_VAR) then
                 if try_to_consume(_VAR) then
@@ -403,7 +419,7 @@ implementation
                 repeat
                 repeat
                   inc(paranr);
                   inc(paranr);
                   hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrordef,[]);
                   hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrordef,[]);
-                  readprocdef.parast.insert(hreadparavs);
+                  p.parast.insert(hreadparavs);
                   sc.add(hreadparavs);
                   sc.add(hreadparavs);
                   consume(_ID);
                   consume(_ID);
                 until not try_to_consume(_COMMA);
                 until not try_to_consume(_COMMA);
@@ -424,22 +440,19 @@ implementation
                 else
                 else
                   hdef:=cformaltype;
                   hdef:=cformaltype;
                 for i:=0 to sc.count-1 do
                 for i:=0 to sc.count-1 do
-                  begin
-                    hreadparavs:=tparavarsym(sc[i]);
-                    hreadparavs.vardef:=hdef;
-                    { also update the writeprocdef }
-                    hparavs:=tparavarsym.create(hreadparavs.realname,hreadparavs.paranr,vs_value,hdef,[]);
-                    writeprocdef.parast.insert(hparavs);
-                  end;
+                  tparavarsym(sc[i]).vardef:=hdef;
               until not try_to_consume(_SEMICOLON);
               until not try_to_consume(_SEMICOLON);
               sc.free;
               sc.free;
-              symtablestack.pop(readprocdef.parast);
+              symtablestack.pop(p.parast);
               consume(_RECKKLAMMER);
               consume(_RECKKLAMMER);
 
 
               { the parser need to know if a property has parameters, the
               { the parser need to know if a property has parameters, the
                 index parameter doesn't count (PFV) }
                 index parameter doesn't count (PFV) }
               if paranr>0 then
               if paranr>0 then
-                include(p.propoptions,ppo_hasparameters);
+                begin
+                  add_parameters(p,readprocdef,writeprocdef);
+                  include(p.propoptions,ppo_hasparameters);
+                end;
            end;
            end;
          { overridden property ?                                 }
          { overridden property ?                                 }
          { force property interface
          { force property interface
@@ -500,7 +513,13 @@ implementation
                   p.propdef:=tpropertysym(overridden).propdef;
                   p.propdef:=tpropertysym(overridden).propdef;
                   p.index:=tpropertysym(overridden).index;
                   p.index:=tpropertysym(overridden).index;
                   p.default:=tpropertysym(overridden).default;
                   p.default:=tpropertysym(overridden).default;
-                  p.propoptions:=tpropertysym(overridden).propoptions;
+                  p.propoptions:=tpropertysym(overridden).propoptions + [ppo_overrides];
+                  if ppo_hasparameters in p.propoptions then
+                    begin
+                      p.parast:=tpropertysym(overridden).parast.getcopy;
+                      add_parameters(p,readprocdef,writeprocdef);
+                      paranr:=p.parast.SymList.Count;
+                    end;
                   if ppo_indexed in p.propoptions then
                   if ppo_indexed in p.propoptions then
                     add_index_parameter(paranr,p,readprocdef,writeprocdef);
                     add_index_parameter(paranr,p,readprocdef,writeprocdef);
                 end
                 end

+ 780 - 39
compiler/pexpr.pas

@@ -100,47 +100,47 @@ implementation
       begin
       begin
          def:=cshortstringtype;
          def:=cshortstringtype;
          consume(_STRING);
          consume(_STRING);
-         if (token=_LECKKLAMMER) then
+         if token=_LECKKLAMMER then
            begin
            begin
-              if not(allowtypedef) then
-                Message(parser_e_no_local_para_def);
-              consume(_LECKKLAMMER);
-              p:=comp_expr(true,false);
-              if not is_constintnode(p) then
-                begin
-                  Message(parser_e_illegal_expression);
-                  { error recovery }
-                  consume(_RECKKLAMMER);
-                end
-              else
-                begin
-                 if (tordconstnode(p).value<=0) then
-                   begin
-                      Message(parser_e_invalid_string_size);
-                      tordconstnode(p).value:=255;
-                   end;
+             if not(allowtypedef) then
+               Message(parser_e_no_local_para_def);
+             consume(_LECKKLAMMER);
+             p:=comp_expr(true,false);
+             if not is_constintnode(p) then
+               begin
+                 Message(parser_e_illegal_expression);
+                 { error recovery }
                  consume(_RECKKLAMMER);
                  consume(_RECKKLAMMER);
-                 if tordconstnode(p).value>255 then
+               end
+             else
+               begin
+                if (tordconstnode(p).value<=0) then
                   begin
                   begin
-                    { longstring is currently unsupported (CEC)! }
-{                   t:=tstringdef.createlong(tordconstnode(p).value))}
                      Message(parser_e_invalid_string_size);
                      Message(parser_e_invalid_string_size);
                      tordconstnode(p).value:=255;
                      tordconstnode(p).value:=255;
-                     def:=tstringdef.createshort(int64(tordconstnode(p).value));
+                  end;
+                if tordconstnode(p).value>255 then
+                  begin
+                    { longstring is currently unsupported (CEC)! }
+{                    t:=tstringdef.createlong(tordconstnode(p).value))}
+                    Message(parser_e_invalid_string_size);
+                    tordconstnode(p).value:=255;
+                    def:=tstringdef.createshort(int64(tordconstnode(p).value));
                   end
                   end
-                 else
-                   if tordconstnode(p).value<>255 then
-                     def:=tstringdef.createshort(int64(tordconstnode(p).value));
-               end;
-              p.free;
+                else
+                  if tordconstnode(p).value<>255 then
+                    def:=tstringdef.createshort(int64(tordconstnode(p).value));
+                consume(_RECKKLAMMER);
+              end;
+             p.free;
            end
            end
-          else
-            begin
-              if cs_ansistrings in current_settings.localswitches then
-                def:=cansistringtype
-              else
-                def:=cshortstringtype;
-            end;
+         else
+           begin
+             if cs_ansistrings in current_settings.localswitches then
+               def:=getansistringdef
+             else
+               def:=cshortstringtype;
+           end;
        end;
        end;
 
 
 
 
@@ -392,14 +392,17 @@ implementation
               in_args:=true;
               in_args:=true;
               p1:=comp_expr(true,false);
               p1:=comp_expr(true,false);
               consume(_RKLAMMER);
               consume(_RKLAMMER);
-              if (p1.nodetype<>typen) and
+              if ((p1.nodetype<>typen) and
+
                  (
                  (
                   (is_object(p1.resultdef) and
                   (is_object(p1.resultdef) and
                    (oo_has_constructor in tobjectdef(p1.resultdef).objectoptions)) or
                    (oo_has_constructor in tobjectdef(p1.resultdef).objectoptions)) or
                   is_open_array(p1.resultdef) or
                   is_open_array(p1.resultdef) or
                   is_array_of_const(p1.resultdef) or
                   is_array_of_const(p1.resultdef) or
                   is_open_string(p1.resultdef)
                   is_open_string(p1.resultdef)
-                 ) then
+                 )) or
+                 { keep the function call if it is a type parameter to avoid arithmetic errors due to constant folding }
+                 (p1.resultdef.typ=undefineddef) then
                 begin
                 begin
                   statement_syssym:=geninlinenode(in_sizeof_x,false,p1);
                   statement_syssym:=geninlinenode(in_sizeof_x,false,p1);
                   { no packed bit support for these things }
                   { no packed bit support for these things }
@@ -924,7 +927,7 @@ implementation
                   the function directly and not through the vmt (PFV) }
                   the function directly and not through the vmt (PFV) }
                 if (cnf_inherited in callflags) then
                 if (cnf_inherited in callflags) then
                   begin
                   begin
-                    include(p2.flags,nf_inherited);
+                    include(tloadnode(p2).loadnodeflags,loadnf_inherited);
                     p1.free;
                     p1.free;
                     p1:=load_self_node;
                     p1:=load_self_node;
                   end;
                   end;
@@ -2249,6 +2252,109 @@ implementation
                           not(cs_compilesystem in current_settings.moduleswitches) then
                           not(cs_compilesystem in current_settings.moduleswitches) then
                          current_module.flags:=current_module.flags or uf_uses_variants;
                          current_module.flags:=current_module.flags or uf_uses_variants;
                        p1:=handle_factor_typenode(hdef,getaddr,again,srsym);
                        p1:=handle_factor_typenode(hdef,getaddr,again,srsym);
+                       (*{ if we get a generic then check that it is not an inline specialization }
+                       if (df_generic in hdef.defoptions) and
+                          (token=_LT) and
+                          (m_delphi in current_settings.modeswitches) then
+                          generate_specialization(hdef,false,'');
+                       { allow Ordinal(Value) for type declarations since it
+                         can be an enummeration declaration or a set lke:
+                         (OrdinalType(const1)..OrdinalType(const2) }
+                       if (not typeonly or is_ordinal(hdef))and try_to_consume(_LKLAMMER) then
+                        begin
+                          p1:=comp_expr(true,false);
+                          consume(_RKLAMMER);
+                          { type casts to class helpers aren't allowed }
+                          if is_objectpascal_helper(hdef) then
+                            Message(parser_e_no_category_as_types)
+                            { recovery by not creating a conversion node }
+                          else
+                            p1:=ctypeconvnode.create_explicit(p1,hdef);
+                        end
+                       else { not LKLAMMER }
+                        if (token=_POINT) and
+                           (is_object(hdef) or is_record(hdef)) then
+                         begin
+                           consume(_POINT);
+                           { handles calling methods declared in parent objects
+                             using "parentobject.methodname()" }
+                           if assigned(current_structdef) and
+                              not(getaddr) and
+                              current_structdef.is_related(hdef) then
+                             begin
+                               p1:=ctypenode.create(hdef);
+                               { search also in inherited methods }
+                               searchsym_in_class(tobjectdef(hdef),tobjectdef(current_structdef),pattern,srsym,srsymtable,true);
+                               if assigned(srsym) then
+                                 check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                               consume(_ID);
+                               do_member_read(tabstractrecorddef(hdef),false,srsym,p1,again,[]);
+                             end
+                           else
+                            begin
+                              { handles:
+                                  * @TObject.Load
+                                  * static methods and variables }
+                              p1:=ctypenode.create(hdef);
+                              { TP allows also @TMenu.Load if Load is only }
+                              { defined in an anchestor class              }
+                              srsym:=search_struct_member(tabstractrecorddef(hdef),pattern);
+                              if assigned(srsym) then
+                                begin
+                                  check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                                      consume(_ID);
+                                      do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[]);
+                                end
+                              else
+                                Message1(sym_e_id_no_member,orgpattern);
+                            end;
+                         end
+                       else
+                        begin
+                          { Normally here would be the check against the usage
+                            of "TClassHelper.Something", but as that might be
+                            used inside of system symbols like sizeof and
+                            typeinfo this check is put into ttypenode.pass_1
+                            (for "TClassHelper" alone) and tcallnode.pass_1
+                            (for "TClassHelper.Something") }
+                          { class reference ? }
+                          if is_class(hdef) or
+                             is_objcclass(hdef) then
+                           begin
+                             if getaddr and (token=_POINT) then
+                              begin
+                                consume(_POINT);
+                                { allows @Object.Method }
+                                { also allows static methods and variables }
+                                p1:=ctypenode.create(hdef);
+                                { TP allows also @TMenu.Load if Load is only }
+                                { defined in an anchestor class              }
+                                srsym:=search_struct_member(tobjectdef(hdef),pattern);
+                                if assigned(srsym) then
+                                 begin
+                                   check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                                   consume(_ID);
+                                   do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[]);
+                                 end
+                                else
+                                 begin
+                                   Message1(sym_e_id_no_member,orgpattern);
+                                   consume(_ID);
+                                 end;
+                              end
+                             else
+                              begin
+                                p1:=ctypenode.create(hdef);
+                                { For a type block we simply return only
+                                  the type. For all other blocks we return
+                                  a loadvmt node }
+                                if not(block_type in [bt_type,bt_const_type,bt_var_type]) then
+                                  p1:=cloadvmtaddrnode.create(p1);
+                              end;
+                           end
+                          else
+                           p1:=ctypenode.create(hdef);
+                        end;*)
                      end;
                      end;
                   end;
                   end;
 
 
@@ -2263,7 +2369,7 @@ implementation
                       begin
                       begin
                         p1:=cloadnode.create(srsym,srsymtable);
                         p1:=cloadnode.create(srsym,srsymtable);
                         do_typecheckpass(p1);
                         do_typecheckpass(p1);
-                        p1.resultdef:=cansistringtype;
+                        p1.resultdef:=getansistringdef;
                       end
                       end
                     else
                     else
                       p1:=genconstsymtree(tconstsym(srsym));
                       p1:=genconstsymtree(tconstsym(srsym));
@@ -2416,6 +2522,637 @@ implementation
          end;
          end;
 
 
 
 
+         {---------------------------------------------
+                        PostFixOperators
+         ---------------------------------------------}
+
+    (*  { returns whether or not p1 has been changed }
+      function postfixoperators(var p1:tnode;var again:boolean): boolean;
+
+        { tries to avoid syntax errors after invalid qualifiers }
+        procedure recoverconsume_postfixops;
+          begin
+            repeat
+              if not try_to_consume(_CARET) then
+                if try_to_consume(_POINT) then
+                  try_to_consume(_ID)
+                else if try_to_consume(_LECKKLAMMER) then
+                  begin
+                    repeat
+                      comp_expr(true,false);
+                    until not try_to_consume(_COMMA);
+                    consume(_RECKKLAMMER);
+                  end
+                else if try_to_consume(_LKLAMMER) then
+                  begin
+                    repeat
+                      comp_expr(true,false);
+                    until not try_to_consume(_COMMA);
+                    consume(_RKLAMMER);
+                  end
+                else
+                  break;
+            until false;
+          end;
+
+
+        procedure handle_variantarray;
+          var
+            p4 : tnode;
+            newstatement : tstatementnode;
+            tempresultvariant,
+            temp    : ttempcreatenode;
+            paras : tcallparanode;
+            newblock : tnode;
+            countindices : aint;
+          begin
+            { create statements with call initialize the arguments and
+              call fpc_dynarr_setlength }
+            newblock:=internalstatements(newstatement);
+
+            { get temp for array of indicies,
+              we set the real size later }
+            temp:=ctempcreatenode.create(s32inttype,4,tt_persistent,false);
+            addstatement(newstatement,temp);
+
+            countindices:=0;
+            repeat
+              p4:=comp_expr(true,false);
+
+              addstatement(newstatement,cassignmentnode.create(
+                ctemprefnode.create_offset(temp,countindices*s32inttype.size),p4));
+               inc(countindices);
+            until not try_to_consume(_COMMA);
+
+            { set real size }
+            temp.size:=countindices*s32inttype.size;
+
+            consume(_RECKKLAMMER);
+
+            { we need only a write access if a := follows }
+            if token=_ASSIGNMENT then
+              begin
+                consume(_ASSIGNMENT);
+                p4:=comp_expr(true,false);
+
+                { create call to fpc_vararray_put }
+                paras:=ccallparanode.create(cordconstnode.create
+                      (countindices,s32inttype,true),
+                   ccallparanode.create(caddrnode.create_internal
+                  (ctemprefnode.create(temp)),
+                   ccallparanode.create(ctypeconvnode.create_internal(p4,cvarianttype),
+                   ccallparanode.create(ctypeconvnode.create_internal(p1,cvarianttype)
+                     ,nil))));
+
+                addstatement(newstatement,ccallnode.createintern('fpc_vararray_put',paras));
+                addstatement(newstatement,ctempdeletenode.create(temp));
+              end
+            else
+              begin
+                { create temp for result }
+                tempresultvariant:=ctempcreatenode.create(cvarianttype,cvarianttype.size,tt_persistent,true);
+                addstatement(newstatement,tempresultvariant);
+
+                { create call to fpc_vararray_get }
+                paras:=ccallparanode.create(cordconstnode.create
+                      (countindices,s32inttype,true),
+                   ccallparanode.create(caddrnode.create_internal
+                  (ctemprefnode.create(temp)),
+                   ccallparanode.create(p1,
+                   ccallparanode.create(
+                       ctemprefnode.create(tempresultvariant)
+                     ,nil))));
+
+                addstatement(newstatement,ccallnode.createintern('fpc_vararray_get',paras));
+                addstatement(newstatement,ctempdeletenode.create(temp));
+                { the last statement should return the value as
+                  location and type, this is done be referencing the
+                  temp and converting it first from a persistent temp to
+                  normal temp }
+                addstatement(newstatement,ctempdeletenode.create_normal_temp(tempresultvariant));
+                addstatement(newstatement,ctemprefnode.create(tempresultvariant));
+              end;
+            p1:=newblock;
+          end;
+
+        function parse_array_constructor(arrdef:tarraydef): tnode;
+          var
+            newstatement,assstatement:tstatementnode;
+            arrnode:ttempcreatenode;
+            temp2:ttempcreatenode;
+            assnode:tnode;
+            paracount:integer;
+          begin
+            result:=internalstatements(newstatement);
+            { create temp for result }
+            arrnode:=ctempcreatenode.create(arrdef,arrdef.size,tt_persistent,true);
+            addstatement(newstatement,arrnode);
+
+            paracount:=0;
+            { check arguments and create an assignment calls }
+            if try_to_consume(_LKLAMMER) then
+              begin
+                assnode:=internalstatements(assstatement);
+                repeat
+                  { arr[i] := param_i }
+                  addstatement(assstatement,
+                    cassignmentnode.create(
+                      cvecnode.create(
+                        ctemprefnode.create(arrnode),
+                        cordconstnode.create(paracount,arrdef.rangedef,false)),
+                      comp_expr(true,false)));
+                  inc(paracount);
+                until not try_to_consume(_COMMA);
+                consume(_RKLAMMER);
+              end
+            else
+              assnode:=nil;
+
+            { get temp for array of lengths }
+            temp2:=ctempcreatenode.create(sinttype,sinttype.size,tt_persistent,false);
+            addstatement(newstatement,temp2);
+
+            { one dimensional }
+            addstatement(newstatement,cassignmentnode.create(
+                ctemprefnode.create_offset(temp2,0),
+                cordconstnode.create
+                   (paracount,s32inttype,true)));
+            { create call to fpc_dynarr_setlength }
+            addstatement(newstatement,ccallnode.createintern('fpc_dynarray_setlength',
+                ccallparanode.create(caddrnode.create_internal
+                      (ctemprefnode.create(temp2)),
+                   ccallparanode.create(cordconstnode.create
+                      (1,s32inttype,true),
+                   ccallparanode.create(caddrnode.create_internal
+                      (crttinode.create(tstoreddef(arrdef),initrtti,rdt_normal)),
+                   ccallparanode.create(
+                     ctypeconvnode.create_internal(
+                       ctemprefnode.create(arrnode),voidpointertype),
+                     nil))))
+
+              ));
+            { add assignment statememnts }
+            addstatement(newstatement,ctempdeletenode.create(temp2));
+            if assigned(assnode) then
+              addstatement(newstatement,assnode);
+            { the last statement should return the value as
+              location and type, this is done be referencing the
+              temp and converting it first from a persistent temp to
+              normal temp }
+            addstatement(newstatement,ctempdeletenode.create_normal_temp(arrnode));
+            addstatement(newstatement,ctemprefnode.create(arrnode));
+          end;
+
+        var
+          protsym  : tpropertysym;
+          p2,p3  : tnode;
+          srsym  : tsym;
+          srsymtable : TSymtable;
+          structh    : tabstractrecorddef;
+          { shouldn't be used that often, so the extra overhead is ok to save
+            stack space }
+          dispatchstring : ansistring;
+          nodechanged    : boolean;
+          calltype: tdispcalltype;
+        label
+          skipreckklammercheck;
+        begin
+          result:=false;
+          again:=true;
+          while again do
+           begin
+             { we need the resultdef }
+             do_typecheckpass_changed(p1,nodechanged);
+             result:=result or nodechanged;
+
+             if codegenerror then
+              begin
+                recoverconsume_postfixops;
+                exit;
+              end;
+             { handle token }
+             case token of
+               _CARET:
+                  begin
+                    consume(_CARET);
+
+                    { support tp/mac procvar^ if the procvar returns a
+                      pointer type }
+                    if ((m_tp_procvar in current_settings.modeswitches) or
+                        (m_mac_procvar in current_settings.modeswitches)) and
+                       (p1.resultdef.typ=procvardef) and
+                       (tprocvardef(p1.resultdef).returndef.typ=pointerdef) then
+                      begin
+                        p1:=ccallnode.create_procvar(nil,p1);
+                        typecheckpass(p1);
+                      end;
+
+                    if (p1.resultdef.typ<>pointerdef) then
+                      begin
+                         { ^ as binary operator is a problem!!!! (FK) }
+                         again:=false;
+                         Message(parser_e_invalid_qualifier);
+                         recoverconsume_postfixops;
+                         p1.destroy;
+                         p1:=cerrornode.create;
+                      end
+                    else
+                      p1:=cderefnode.create(p1);
+                  end;
+
+               _LECKKLAMMER:
+                  begin
+                    if is_class_or_interface_or_object(p1.resultdef) or
+                      is_dispinterface(p1.resultdef) or is_record(p1.resultdef) then
+                      begin
+                        { default property }
+                        protsym:=search_default_property(tabstractrecorddef(p1.resultdef));
+                        if not(assigned(protsym)) then
+                          begin
+                             p1.destroy;
+                             p1:=cerrornode.create;
+                             again:=false;
+                             message(parser_e_no_default_property_available);
+                          end
+                        else
+                          begin
+                            { The property symbol is referenced indirect }
+                            protsym.IncRefCount;
+                            handle_propertysym(protsym,protsym.owner,p1);
+                          end;
+                      end
+                    else
+                      begin
+                        consume(_LECKKLAMMER);
+                        repeat
+                          { in all of the cases below, p1 is changed }
+                          case p1.resultdef.typ of
+                            pointerdef:
+                              begin
+                                 { support delphi autoderef }
+                                 if (tpointerdef(p1.resultdef).pointeddef.typ=arraydef) and
+                                    (m_autoderef in current_settings.modeswitches) then
+                                   p1:=cderefnode.create(p1);
+                                 p2:=comp_expr(true,false);
+                                 { Support Pbytevar[0..9] which returns array [0..9].}
+                                 if try_to_consume(_POINTPOINT) then
+                                   p2:=crangenode.create(p2,comp_expr(true,false));
+                                 p1:=cvecnode.create(p1,p2);
+                              end;
+                            variantdef:
+                              begin
+                                handle_variantarray;
+                                { the RECKKLAMMER is already read }
+                                goto skipreckklammercheck;
+                              end;
+                            stringdef :
+                              begin
+                                p2:=comp_expr(true,false);
+                                { Support string[0..9] which returns array [0..9] of char.}
+                                if try_to_consume(_POINTPOINT) then
+                                  p2:=crangenode.create(p2,comp_expr(true,false));
+                                p1:=cvecnode.create(p1,p2);
+                              end;
+                            arraydef:
+                              begin
+                                p2:=comp_expr(true,false);
+                                { support SEG:OFS for go32v2 Mem[] }
+                                if (target_info.system in [system_i386_go32v2,system_i386_watcom]) and
+                                   (p1.nodetype=loadn) and
+                                   assigned(tloadnode(p1).symtableentry) and
+                                   assigned(tloadnode(p1).symtableentry.owner.name) and
+                                   (tloadnode(p1).symtableentry.owner.name^='SYSTEM') and
+                                   ((tloadnode(p1).symtableentry.name='MEM') or
+                                    (tloadnode(p1).symtableentry.name='MEMW') or
+                                    (tloadnode(p1).symtableentry.name='MEML')) then
+                                  begin
+                                    if try_to_consume(_COLON) then
+                                     begin
+                                       p3:=caddnode.create(muln,cordconstnode.create($10,s32inttype,false),p2);
+                                       p2:=comp_expr(true,false);
+                                       p2:=caddnode.create(addn,p2,p3);
+                                       if try_to_consume(_POINTPOINT) then
+                                         { Support mem[$a000:$0000..$07ff] which returns array [0..$7ff] of memtype.}
+                                         p2:=crangenode.create(p2,caddnode.create(addn,comp_expr(true,false),p3.getcopy));
+                                       p1:=cvecnode.create(p1,p2);
+                                       include(tvecnode(p1).flags,nf_memseg);
+                                       include(tvecnode(p1).flags,nf_memindex);
+                                     end
+                                    else
+                                     begin
+                                       if try_to_consume(_POINTPOINT) then
+                                         { Support mem[$80000000..$80000002] which returns array [0..2] of memtype.}
+                                         p2:=crangenode.create(p2,comp_expr(true,false));
+                                       p1:=cvecnode.create(p1,p2);
+                                       include(tvecnode(p1).flags,nf_memindex);
+                                     end;
+                                  end
+                                else
+                                  begin
+                                    if try_to_consume(_POINTPOINT) then
+                                      { Support arrayvar[0..9] which returns array [0..9] of arraytype.}
+                                      p2:=crangenode.create(p2,comp_expr(true,false));
+                                    p1:=cvecnode.create(p1,p2);
+                                  end;
+                              end;
+                            else
+                              begin
+                                if p1.resultdef.typ<>undefineddef then
+                                  Message(parser_e_invalid_qualifier);
+                                p1.destroy;
+                                p1:=cerrornode.create;
+                                comp_expr(true,false);
+                                again:=false;
+                              end;
+                          end;
+                          do_typecheckpass(p1);
+                        until not try_to_consume(_COMMA);
+                        consume(_RECKKLAMMER);
+                        { handle_variantarray eats the RECKKLAMMER and jumps here }
+                      skipreckklammercheck:
+                      end;
+                  end;
+
+               _POINT :
+                  begin
+                    consume(_POINT);
+                    if (p1.resultdef.typ=pointerdef) and
+                       (m_autoderef in current_settings.modeswitches) and
+                       { don't auto-deref objc.id, because then the code
+                         below for supporting id.anyobjcmethod isn't triggered }
+                       (p1.resultdef<>objc_idtype) then
+                      begin
+                        p1:=cderefnode.create(p1);
+                        do_typecheckpass(p1);
+                      end;
+                    { procvar.<something> can never mean anything so always
+                      try to call it in case it returns a record/object/... }
+                    maybe_call_procvar(p1,false);
+
+                    case p1.resultdef.typ of
+                      recorddef:
+                        begin
+                          if token=_ID then
+                            begin
+                              structh:=tabstractrecorddef(p1.resultdef);
+                              searchsym_in_record(structh,pattern,srsym,srsymtable);
+                              if assigned(srsym) then
+                                begin
+                                  check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                                  consume(_ID);
+                                  do_member_read(structh,getaddr,srsym,p1,again,[]);
+                                end
+                              else
+                                begin
+                                  Message1(sym_e_id_no_member,orgpattern);
+                                  p1.destroy;
+                                  p1:=cerrornode.create;
+                                  { try to clean up }
+                                  consume(_ID);
+                                end;
+                            end
+                          else
+                          consume(_ID);
+                        end;
+                      enumdef:
+                        begin
+                          if token=_ID then
+                            begin
+                              srsym:=tsym(tenumdef(p1.resultdef).symtable.Find(pattern));
+                              p1.destroy;
+                              if assigned(srsym) and (srsym.typ=enumsym) then
+                                begin
+                                  check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                                  p1:=genenumnode(tenumsym(srsym));
+                                end
+                              else
+                                begin
+                                  Message1(sym_e_id_no_member,orgpattern);
+                                  p1:=cerrornode.create;
+                                end;
+                            end;
+                          consume(_ID);
+                        end;
+                      arraydef:
+                        begin
+                          if is_dynamic_array(p1.resultdef) then
+                            begin
+                              if token=_ID then
+                                begin
+                                  if pattern='CREATE' then
+                                    begin
+                                      consume(_ID);
+                                      p2:=parse_array_constructor(tarraydef(p1.resultdef));
+                                      p1.destroy;
+                                      p1:=p2;
+                                    end
+                                  else
+                                    begin
+                                      Message2(scan_f_syn_expected,'CREATE',pattern);
+                                      p1.destroy;
+                                      p1:=cerrornode.create;
+                                      consume(_ID);
+                                    end;
+                                end;
+                            end
+                          else
+                            begin
+                              Message(parser_e_invalid_qualifier);
+                              p1.destroy;
+                              p1:=cerrornode.create;
+                              consume(_ID);
+                            end;
+                        end;
+                       variantdef:
+                         begin
+                           { dispatch call? }
+                           { lhs := v.ident[parameters] -> property get
+                             lhs := v.ident(parameters) -> method call
+                             v.ident[parameters] := rhs -> property put
+                             v.ident(parameters) := rhs -> also property put }
+                           if token=_ID then
+                             begin
+                               dispatchstring:=orgpattern;
+                               consume(_ID);
+                               calltype:=dct_method;
+                               if try_to_consume(_LKLAMMER) then
+                                 begin
+                                   p2:=parse_paras(false,true,_RKLAMMER);
+                                   consume(_RKLAMMER);
+                                 end
+                               else if try_to_consume(_LECKKLAMMER) then
+                                 begin
+                                   p2:=parse_paras(false,true,_RECKKLAMMER);
+                                   consume(_RECKKLAMMER);
+                                   calltype:=dct_propget;
+                                 end
+                               else
+                                 p2:=nil;
+                               { property setter? }
+                               if (token=_ASSIGNMENT) and not(afterassignment) then
+                                 begin
+                                   consume(_ASSIGNMENT);
+                                   { read the expression }
+                                   p3:=comp_expr(true,false);
+                                   { concat value parameter too }
+                                   p2:=ccallparanode.create(p3,p2);
+                                   p1:=translate_disp_call(p1,p2,dct_propput,dispatchstring,0,voidtype);
+                                 end
+                               else
+                               { this is only an approximation
+                                 setting useresult if not necessary is only a waste of time, no more, no less (FK) }
+                               if afterassignment or in_args or (token<>_SEMICOLON) then
+                                 p1:=translate_disp_call(p1,p2,calltype,dispatchstring,0,cvarianttype)
+                               else
+                                 p1:=translate_disp_call(p1,p2,calltype,dispatchstring,0,voidtype);
+                             end
+                           else { Error }
+                             Consume(_ID);
+                          end;
+                       classrefdef:
+                         begin
+                           if token=_ID then
+                             begin
+                               structh:=tobjectdef(tclassrefdef(p1.resultdef).pointeddef);
+                               searchsym_in_class(tobjectdef(structh),tobjectdef(structh),pattern,srsym,srsymtable,true);
+                               if assigned(srsym) then
+                                 begin
+                                   check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                                   consume(_ID);
+                                   do_member_read(structh,getaddr,srsym,p1,again,[]);
+                                 end
+                               else
+                                 begin
+                                   Message1(sym_e_id_no_member,orgpattern);
+                                   p1.destroy;
+                                   p1:=cerrornode.create;
+                                   { try to clean up }
+                                   consume(_ID);
+                                 end;
+                             end
+                           else { Error }
+                             Consume(_ID);
+                         end;
+                       objectdef:
+                         begin
+                           if token=_ID then
+                             begin
+                               structh:=tobjectdef(p1.resultdef);
+                               searchsym_in_class(tobjectdef(structh),tobjectdef(structh),pattern,srsym,srsymtable,true);
+                               if assigned(srsym) then
+                                 begin
+                                    check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
+                                    consume(_ID);
+                                    do_member_read(structh,getaddr,srsym,p1,again,[]);
+                                 end
+                               else
+                                 begin
+                                    Message1(sym_e_id_no_member,orgpattern);
+                                    p1.destroy;
+                                    p1:=cerrornode.create;
+                                    { try to clean up }
+                                    consume(_ID);
+                                 end;
+                             end
+                           else { Error }
+                             Consume(_ID);
+                         end;
+                       pointerdef:
+                         begin
+                           if (p1.resultdef=objc_idtype) then
+                             begin
+                               { objc's id type can be used to call any
+                                 Objective-C method of any Objective-C class
+                                 type that's currently in scope }
+                               if search_objc_method(pattern,srsym,srsymtable) then
+                                 begin
+                                   consume(_ID);
+                                   do_proc_call(srsym,srsymtable,nil,
+                                     (getaddr and not(token in [_CARET,_POINT])),
+                                     again,p1,[cnf_objc_id_call]);
+                                   { we need to know which procedure is called }
+                                   do_typecheckpass(p1);
+                                 end
+                               else
+                                 begin
+                                   consume(_ID);
+                                   Message(parser_e_methode_id_expected);
+                                 end;
+                             end
+                           else
+                             begin
+                               Message(parser_e_invalid_qualifier);
+                               if tpointerdef(p1.resultdef).pointeddef.typ in [recorddef,objectdef,classrefdef] then
+                                 Message(parser_h_maybe_deref_caret_missing);
+                             end
+                         end;
+                       else
+                         begin
+                           if p1.resultdef.typ<>undefineddef then
+                             Message(parser_e_invalid_qualifier);
+                           p1.destroy;
+                           p1:=cerrornode.create;
+                           { Error }
+                           consume(_ID);
+                         end;
+                    end;
+                  end;
+
+               else
+                 begin
+                   { is this a procedure variable ? }
+                   if assigned(p1.resultdef) and
+                      (p1.resultdef.typ=procvardef) then
+                     begin
+                       { Typenode for typecasting or expecting a procvar }
+                       if (p1.nodetype=typen) or
+                          (
+                           assigned(getprocvardef) and
+                           equal_defs(p1.resultdef,getprocvardef)
+                          ) then
+                         begin
+                           if try_to_consume(_LKLAMMER) then
+                             begin
+                               p1:=comp_expr(true,false);
+                               consume(_RKLAMMER);
+                               p1:=ctypeconvnode.create_explicit(p1,p1.resultdef);
+                             end
+                           else
+                             again:=false
+                         end
+                       else
+                         begin
+                           if try_to_consume(_LKLAMMER) then
+                             begin
+                               p2:=parse_paras(false,false,_RKLAMMER);
+                               consume(_RKLAMMER);
+                               p1:=ccallnode.create_procvar(p2,p1);
+                               { proc():= is never possible }
+                               if token=_ASSIGNMENT then
+                                 begin
+                                   Message(parser_e_illegal_expression);
+                                   p1.free;
+                                   p1:=cerrornode.create;
+                                   again:=false;
+                                 end;
+                             end
+                           else
+                             again:=false;
+                         end;
+                     end
+                   else
+                     again:=false;
+                  end;
+             end;
+
+             { we only try again if p1 was changed }
+             if again or
+                (p1.nodetype=errorn) then
+               result:=true;
+           end; { while again }
+        end;*)
+
+
       {---------------------------------------------
       {---------------------------------------------
                       Factor (Main)
                       Factor (Main)
       ---------------------------------------------}
       ---------------------------------------------}
@@ -3240,7 +3977,11 @@ implementation
                _OP_NOT :
                _OP_NOT :
                  p1:=cnotnode.create(p1);
                  p1:=cnotnode.create(p1);
                _OP_MOD :
                _OP_MOD :
-                 p1:=cmoddivnode.create(modn,p1,p2);
+                 begin
+                   p1:=cmoddivnode.create(modn,p1,p2);
+                   if m_iso in current_settings.modeswitches then
+                     include(p1.flags,nf_isomod);
+                 end;
                _OP_SHL :
                _OP_SHL :
                  p1:=cshlshrnode.create(shln,p1,p2);
                  p1:=cshlshrnode.create(shln,p1,p2);
                _OP_SHR :
                _OP_SHR :

+ 27 - 7
compiler/pinline.pas

@@ -57,7 +57,7 @@ implementation
        scanner,
        scanner,
        pbase,pexpr,
        pbase,pexpr,
        { codegen }
        { codegen }
-       cgbase
+       cgbase,procinfo
        ;
        ;
 
 
 
 
@@ -508,12 +508,22 @@ implementation
         isarray:=is_dynamic_array(destppn.resultdef);
         isarray:=is_dynamic_array(destppn.resultdef);
         if not((destppn.resultdef.typ=stringdef) or
         if not((destppn.resultdef.typ=stringdef) or
                isarray) then
                isarray) then
-         begin
-           CGMessage(type_e_mismatch);
-           paras.free;
-           exit;
-         end;
-
+          begin
+            { possibly generic involved? }
+            if df_generic in current_procinfo.procdef.defoptions then
+              begin
+                result.free;
+                result:=internalstatements(newstatement);
+                paras.free;
+                exit;
+              end
+            else
+              begin
+                CGMessage(type_e_mismatch);
+                paras.free;
+                exit;
+              end;
+          end;
         { only dynamic arrays accept more dimensions }
         { only dynamic arrays accept more dimensions }
         if (dims>1) then
         if (dims>1) then
          begin
          begin
@@ -576,6 +586,16 @@ implementation
             { we don't need original the callparanodes tree }
             { we don't need original the callparanodes tree }
             paras.free;
             paras.free;
          end
          end
+        else if is_ansistring(destppn.resultdef) then
+         begin
+            newblock:=ccallnode.createintern(
+              'fpc_'+tstringdef(destppn.resultdef).stringtypname+'_setlength',
+              ccallparanode.create(
+                cordconstnode.create(getparaencoding(destppn.resultdef),u16inttype,true),
+                paras
+              )
+            );
+         end
         else
         else
          begin
          begin
             { we can reuse the supplied parameters }
             { we can reuse the supplied parameters }

+ 2 - 2
compiler/pmodules.pas

@@ -1769,12 +1769,12 @@ implementation
       { rename }
       { rename }
         if PPUFn=PPLFn then
         if PPUFn=PPLFn then
          begin
          begin
-           {$I-}
+           {$push}{$I-}
             assign(f,PPUFn);
             assign(f,PPUFn);
             erase(f);
             erase(f);
             assign(f,'ppumove.$$$');
             assign(f,'ppumove.$$$');
             rename(f,PPUFn);
             rename(f,PPUFn);
-           {$I+}
+           {$pop}
            if ioresult<>0 then;
            if ioresult<>0 then;
          end;
          end;
         Result:=True;
         Result:=True;

+ 3 - 0
compiler/powerpc/agppcmpw.pas

@@ -25,6 +25,9 @@
 unit agppcmpw;
 unit agppcmpw;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
+ { We know that use_PR is a const boolean
+   but we don't care about this warning }
+ {$WARN 6018 OFF}
 
 
 interface
 interface
 
 

+ 2 - 16
compiler/powerpc/nppcmat.pas

@@ -61,15 +61,9 @@ implementation
       cpubase,
       cpubase,
       ncgutil,cgcpu;
       ncgutil,cgcpu;
 
 
-{$ifopt r+}
+{$push}
 {$r-}
 {$r-}
-{$define rangeon}
-{$endif}
-
-{$ifopt q+}
 {$q-}
 {$q-}
-{$define overflowon}
-{$endif}
 { helper functions }
 { helper functions }
 procedure getmagic_unsigned32(d : dword; out magic_m : dword; out magic_add : boolean; out magic_shift : dword);
 procedure getmagic_unsigned32(d : dword; out magic_m : dword; out magic_add : boolean; out magic_shift : dword);
 var
 var
@@ -153,15 +147,7 @@ begin
     magic_s := p - 32; { resulting shift }
     magic_s := p - 32; { resulting shift }
 end;
 end;
 
 
-{$ifdef rangeon}
-{$r+}
-{$undef rangeon}
-{$endif}
-
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif}
+{$pop}
 
 
 {*****************************************************************************
 {*****************************************************************************
                              TPPCMODDIVNODE
                              TPPCMODDIVNODE

+ 3 - 17
compiler/powerpc64/cgcpu.pas

@@ -175,15 +175,9 @@ begin
   end;
   end;
 end;
 end;
 
 
-{$ifopt r+}
+{$push}
 {$r-}
 {$r-}
-{$define rangeon}
-{$endif}
-
-{$ifopt q+}
 {$q-}
 {$q-}
-{$define overflowon}
-{$endif}
 { helper function which calculate "magic" values for replacement of unsigned
 { helper function which calculate "magic" values for replacement of unsigned
  division by constant operation by multiplication. See the PowerPC compiler
  division by constant operation by multiplication. See the PowerPC compiler
  developer manual for more information }
  developer manual for more information }
@@ -198,7 +192,7 @@ begin
   two_N_minus_1 := aWord(1) shl (N-1);
   two_N_minus_1 := aWord(1) shl (N-1);
 
 
   magic_add := false;
   magic_add := false;
-  nc := - 1 - (-d) mod d;
+  nc := aWord(-1) - (-d) mod d;
   p := N-1; { initialize p }
   p := N-1; { initialize p }
   q1 := two_N_minus_1 div nc; { initialize q1 = 2p/nc }
   q1 := two_N_minus_1 div nc; { initialize q1 = 2p/nc }
   r1 := two_N_minus_1 - q1*nc; { initialize r1 = rem(2p,nc) }
   r1 := two_N_minus_1 - q1*nc; { initialize r1 = rem(2p,nc) }
@@ -275,15 +269,7 @@ begin
   end;
   end;
   magic_s := p - N; { resulting shift }
   magic_s := p - N; { resulting shift }
 end;
 end;
-{$ifdef rangeon}
-{$r+}
-{$undef rangeon}
-{$endif}
-
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif}
+{$pop}
 
 
 { finds positive and negative powers of two of the given value, returning the
 { finds positive and negative powers of two of the given value, returning the
  power and whether it's a negative power or not in addition to the actual result
  power and whether it's a negative power or not in addition to the actual result

+ 2 - 1
compiler/pp.lpi

@@ -25,7 +25,7 @@
     <RunParams>
     <RunParams>
       <local>
       <local>
         <FormatVersion Value="1"/>
         <FormatVersion Value="1"/>
-        <CommandLineParams Value="-n @\home\florian\bin\fpc.cfg \home\florian\fpc\tests\test\cg\tsar1.pp"/>
+        <CommandLineParams Value="-MObjFPC -Scgi -O1 -gl -vewnhi -l -FiD:\programming\laz_svn\fpc_features\cpstr\lib\i386-win32\ -FuD:\programming\laz_svn\cpstr\cpstrnew\ -Fu. -FUD:\programming\laz_svn\fpc_features\cpstr\lib\i386-win32\ -oproject1.exe D:\programming\laz_svn\fpc_features\cpstr\project1.lpr"/>
         <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
         <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
       </local>
       </local>
     </RunParams>
     </RunParams>
@@ -64,6 +64,7 @@
     <Linking>
     <Linking>
       <Debugging>
       <Debugging>
         <GenerateDebugInfo Value="True"/>
         <GenerateDebugInfo Value="True"/>
+        <DebugInfoType Value="dsStabs"/>
       </Debugging>
       </Debugging>
     </Linking>
     </Linking>
     <Other>
     <Other>

+ 5 - 0
compiler/pp.pas

@@ -144,6 +144,11 @@ program pp;
   {$endif i386}
   {$endif i386}
 {$endif support_mmx}
 {$endif support_mmx}
 
 
+
+{ Don't care about minstacksize or maxstacksize not beeing supported by current OS }
+{$WARN 2077 OFF}
+{$WARN 2078 OFF}
+
 {$ifdef win32}
 {$ifdef win32}
   { 256 MB stack }
   { 256 MB stack }
   { under windows the stack can't grow }
   { under windows the stack can't grow }

+ 2 - 7
compiler/ppcgen/aasmcpu.pas

@@ -554,15 +554,10 @@ uses cutils, cclasses;
                            assigned(taicpu(p).oper[0]^.ref^.symbol) and
                            assigned(taicpu(p).oper[0]^.ref^.symbol) and
                            (taicpu(p).oper[0]^.ref^.symbol is tasmlabel) and
                            (taicpu(p).oper[0]^.ref^.symbol is tasmlabel) and
                            (labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr] <> NIL) and
                            (labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr] <> NIL) and
-{$ifopt q+}
+{$push}
 {$q-}
 {$q-}
-{$define overflowon}
-{$endif}
                            (ptruint(abs(ptrint(labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr]-instrpos)) - (low(smallint) div 4)) > ptruint((high(smallint) - low(smallint)) div 4)) then
                            (ptruint(abs(ptrint(labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr]-instrpos)) - (low(smallint) div 4)) > ptruint((high(smallint) - low(smallint)) div 4)) then
-{$ifdef overflowon}
-{$q+}
-{$undef overflowon}
-{$endif}
+{$pop}
                           begin
                           begin
                             // add a new label after this jump
                             // add a new label after this jump
                             current_asmdata.getjumplabel(l);
                             current_asmdata.getjumplabel(l);

+ 18 - 1
compiler/ppcgen/cgppc.pas

@@ -22,7 +22,6 @@
 unit cgppc;
 unit cgppc;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
-
   interface
   interface
 
 
     uses
     uses
@@ -62,6 +61,9 @@ unit cgppc;
         procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override;
         procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override;
 
 
         procedure g_maybe_got_init(list: TAsmList); override;
         procedure g_maybe_got_init(list: TAsmList); override;
+        { Transform unsupported methods into Internal errors }
+        procedure a_bit_scan_reg_reg(list: TAsmList; reverse: boolean; size: TCGSize; src, dst: TRegister); override;
+        procedure g_stackpointer_alloc(list : TAsmList;localsize : longint);override;
        protected
        protected
         function  get_darwin_call_stub(const s: string; weak: boolean): tasmsymbol;
         function  get_darwin_call_stub(const s: string; weak: boolean): tasmsymbol;
         procedure a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister); override;
         procedure a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister); override;
@@ -109,6 +111,11 @@ unit cgppc;
        symconst,symsym,fmodule,
        symconst,symsym,fmodule,
        rgobj,tgobj,cpupi,procinfo,paramgr;
        rgobj,tgobj,cpupi,procinfo,paramgr;
 
 
+{ We know that macos_direct_globals is a const boolean
+  but we don't care about this warning }
+{$NOTE Is macos_direct_globals still useful?}
+{$WARN 6018 OFF}
+
 {$ifdef extdebug}
 {$ifdef extdebug}
      function ref2string(const ref : treference) : string;
      function ref2string(const ref : treference) : string;
        begin
        begin
@@ -524,6 +531,16 @@ unit cgppc;
        end;
        end;
 
 
 
 
+  procedure tcgppcgen.g_stackpointer_alloc(list : TAsmList;localsize : longint);
+    begin
+      Comment(V_Error,'tcgppcgen.g_stackpointer_alloc method not implemented');
+    end;
+
+  procedure tcgppcgen.a_bit_scan_reg_reg(list: TAsmList; reverse: boolean; size: TCGSize; src, dst: TRegister);
+    begin
+      Comment(V_Error,'tcgppcgen.a_bit_scan_reg_reg method not implemented');
+    end;
+
   procedure tcgppcgen.a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister);
   procedure tcgppcgen.a_load_subsetref_regs_noindex(list: TAsmList; subsetsize: tcgsize; loadbitsize: byte; const sref: tsubsetreference; valuereg, extra_value_reg: tregister);
     var
     var
       fromsreg, tosreg: tsubsetregister;
       fromsreg, tosreg: tsubsetregister;

+ 11 - 13
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 {$endif Test_Double_checksum}
 
 
 const
 const
-  CurrentPPUVersion = 138;
+  CurrentPPUVersion = 141;
 
 
 { buffer sizes }
 { buffer sizes }
   maxentrysize = 1024;
   maxentrysize = 1024;
@@ -290,14 +290,14 @@ type
   {read}
   {read}
     function  openfile:boolean;
     function  openfile:boolean;
     procedure reloadbuf;
     procedure reloadbuf;
-    procedure readdata(var b;len:integer);
+    procedure readdata(out b;len:integer);
     procedure skipdata(len:integer);
     procedure skipdata(len:integer);
     function  readentry:byte;
     function  readentry:byte;
     function  EndOfEntry:boolean;
     function  EndOfEntry:boolean;
     function  entrysize:longint;
     function  entrysize:longint;
     function  entryleft:longint;
     function  entryleft:longint;
-    procedure getdatabuf(var b;len:integer;var res:integer);
-    procedure getdata(var b;len:integer);
+    procedure getdatabuf(out b;len:integer;out res:integer);
+    procedure getdata(out b;len:integer);
     function  getbyte:byte;
     function  getbyte:byte;
     function  getword:word;
     function  getword:word;
     function  getdword:dword;
     function  getdword:dword;
@@ -311,8 +311,8 @@ type
     function  getrealsize(sizeofreal : longint):ppureal;
     function  getrealsize(sizeofreal : longint):ppureal;
     function  getstring:string;
     function  getstring:string;
     function  getansistring:ansistring;
     function  getansistring:ansistring;
-    procedure getnormalset(var b);
-    procedure getsmallset(var b);
+    procedure getnormalset(out b);
+    procedure getsmallset(out b);
     function  skipuntilentry(untilb:byte):boolean;
     function  skipuntilentry(untilb:byte):boolean;
   {write}
   {write}
     function  createfile:boolean;
     function  createfile:boolean;
@@ -528,7 +528,7 @@ begin
 end;
 end;
 
 
 
 
-procedure tppufile.readdata(var b;len:integer);
+procedure tppufile.readdata(out b;len:integer);
 var
 var
   p,pbuf : pchar;
   p,pbuf : pchar;
   left : integer;
   left : integer;
@@ -623,7 +623,7 @@ begin
 end;
 end;
 
 
 
 
-procedure tppufile.getdatabuf(var b;len:integer;var res:integer);
+procedure tppufile.getdatabuf(out b;len:integer;out res:integer);
 begin
 begin
   if entryidx+len>entry.size then
   if entryidx+len>entry.size then
    res:=entry.size-entryidx
    res:=entry.size-entryidx
@@ -634,7 +634,7 @@ begin
 end;
 end;
 
 
 
 
-procedure tppufile.getdata(var b;len:integer);
+procedure tppufile.getdata(out b;len:integer);
 begin
 begin
   if entryidx+len>entry.size then
   if entryidx+len>entry.size then
    begin
    begin
@@ -957,7 +957,7 @@ begin
 end;
 end;
 
 
 
 
-procedure tppufile.getsmallset(var b);
+procedure tppufile.getsmallset(out b);
 var
 var
   i : longint;
   i : longint;
 begin
 begin
@@ -968,7 +968,7 @@ begin
 end;
 end;
 
 
 
 
-procedure tppufile.getnormalset(var b);
+procedure tppufile.getnormalset(out b);
 var
 var
   i : longint;
   i : longint;
 begin
 begin
@@ -1330,8 +1330,6 @@ procedure tppufile.putsmallset(const b);
 
 
 
 
 procedure tppufile.putnormalset(const b);
 procedure tppufile.putnormalset(const b);
-  type
-    SetLongintArray = Array [0..7] of longint;
   begin
   begin
     putdata(b,32);
     putdata(b,32);
   end;
   end;

Some files were not shown because too many files changed in this diff