Skip to content

Wrong code generated in trunk x86_64

Summary

for in construct generate bad code on trunk x86_64

System Information

  • Operating system: Tested on Linux
  • Processor architecture: x86_64 (i386 does not show same error)
  • Compiler version: 3.3.1 (3.2.3 and 3.2.2 are OK)
  • Device:

Steps to reproduce

Compile the compiler for arm CPU using `make rtlclean distclean rtl arm OPT="-n -gl -dDEBUGOPTALLOC"

Example Project

With the resulting ppcarm compiler, compile the rtl and any dummy hello.pp source using: ppcarm -altr -O2 hello.pp

What is the current bug behavior?

Inspecting the generated hello.s assembly source, you will see that several 'iregXX' can be found, but there should be no imaginary register present at this stage.

What is the expected (correct) behavior?

Using release 3.2.2 or current fixes 3.2.3, or using i386 compiler (release, fixes or trunk), the generated assembly source displays no imaginary register. This is the expected correct behavior.

Relevant logs and/or screenshots

muller@gcc187:~/pas/check$ cat hello.pp
begin
  writeln('hello!');
end.
 # Go to current trunk source directory
 cd ./compiler
 # Switch to x86_64 release compiler
 rpath
 # Compiler ppcarm using release ppcx64
 make distclean rtlclean  rtl arm OPT="-n -gl -dDEBUG_OPTALLOC"
 # Rename
 mv ppcarm ppcarm-optalloc-3.2.2
 # Do the same using fixes x86_64 compiler
 fpath ; make distclean rtlclean  rtl arm OPT="-n -gl -dDEBUG_OPTALLOC"
 mv ppcarm ppcarm-optalloc-3.2.3
 # Do the same using trunk x86_64 compiler
 spath ; make distclean rtlclean  rtl arm OPT="-n -gl -dDEBUG_OPTALLOC"
 mv ppcarm ppcarm-optalloc-3.3.1
 # Do the same using trunk i386 compiler
 spath32 ; make distclean rtlclean  rtl arm OPT="-n -gl -dDEBUG_OPTALLOC"
 mv ppcarm ppcarm-optalloc-3.3.1-32
 # Do the same using fixes i386 compiler
 fpath32 ; make distclean rtlclean  rtl arm OPT="-n -gl -dDEBUG_OPTALLOC"
 mv ppcarm ppcarm-optalloc-3.2.3-32
 # Do the same using release i386 compiler
 rpath32 ; make distclean rtlclean  rtl arm OPT="-n -gl -dDEBUG_OPTALLOC"
 mv ppcarm ppcarm-optalloc-3.2.2-32
 cd ../rtl
 cd pas/check/
 # Put hello.pp source in that directory
 # Test the six diferent ppcarm compilers
 for f in ~/pas/trunk/fpcsrc/compiler/ppcarm-optalloc-* ; do $f -altr -O2 hello.pp ; mv hello.s hello.s.${f/*ppcarm-optalloc/} ; done

Check which one contains 'wrong' ìreg:

muller@gcc187:~/pas/check$ grep ireg hello.s.*
hello.s.-3.3.1:# r13 ireg45
hello.s.-3.3.1:# r0 r1 r2 r3 r12 r13 r14 ireg32 ireg33 ireg34 ireg35 ireg44 ireg45 ireg46
hello.s.-3.3.1:# r0 r1 r2 r3 r12 r13 r14 ireg32 ireg33 ireg34 ireg35 ireg44 ireg45 ireg46

Possible fixes

No idea!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information