Author Topic: Bug in the compiler/optimizer  (Read 775 times)

Offline LooZee

  • Member
  • *
  • Posts: 0
Bug in the compiler/optimizer
« on: November 20, 2019, 08:15:53 pm »
Hi Pelle,

I found a bug and set up a small program to reproduce it. I noticed it when compiling the vbcc C-Compiler with PellesC. Given the -Os option, PellesC produces incorrect code in this case. Please see the attached lexer.c file. It is part of the ucpp Preprocessor embedded in vbcc. I preprocessed it, so it can simply be compiled with "cc lexer.c" and "cc -Os lexer.c" without additional dependencies.

There is a #define to enable/disable the bug and the program outputs a binary file ("cppm.log"). The output should always be the same (starting with 0x27000000), but it changes with different optimization options (to 0x22000000).

I hope this helps.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2029
Re: Bug in the compiler/optimizer
« Reply #1 on: November 24, 2019, 04:52:52 pm »
OK, I can reproduce. I will look at it...