Wrong code generated in trunk x86_64
## Summary <!-- Summarize the bug encountered concisely --> for in construct generate bad code on trunk x86_64 ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** Tested on Linux <!-- Windows, Linux (if possible, also name the distro), FreeBSD, Android, ... --> - **Processor architecture:** x86_64 (i386 does not show same error) <!-- x86, x86-64, ARM, AARCH64, AVR, RISC-V, PowerPC, ... --> - **Compiler version:** 3.3.1 (3.2.3 and 3.2.2 are OK)<!-- 3.2, 3.2.2, 3.3, trunk, beta, ... (if possible, give also the git hash) --> - **Device:** <!-- Computer, Tablet, Mobile, Amiga, Microcontroller, ... --> ## Steps to reproduce <!-- How one can reproduce the issue - this is very important! --> Compile the compiler for arm CPU using `make rtlclean distclean rtl arm OPT="-n -gl -dDEBUGOPTALLOC" ## Example Project <!-- If possible, please create an example project that exhibits the problematic behavior, and link to it here in the bug report. --> 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? <!-- What actually happens --> 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? <!-- What you should see instead --> 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 <!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as it's very hard to read otherwise. You can also use syntax highlighting for Pascal with: ```pascal the code``` For more information see https://docs.gitlab.com/ee/user/markdown.html --> ``` 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 <!-- If you can, link to the line of code that might be responsible for the problem --> No idea!
issue