NO

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

LooZee

  • Guest
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: 2266
    • http://www.smorgasbordet.com
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...
/Pelle