Menu

#2709 Constants incorrectly propagated over function call

closed-fixed
None
redundancy elimination
7
2018-06-13
2018-01-24
No

SDCC cse incorrectly propagates constants over function calls when the constant is assigned to a variable that had its address taken:

c = 0xaa;
f();
d = c;

Will assign 0xaa to d, even when f() modifies the value of c via a pointer. For a complete example, see the regression test support/regression/tests/bug-2708.c. The bug can be repoduced by removing the preprocessor guard there.

Philipp

Discussion

  • Philipp Klaus Krause

    Since the iCode from dumpraw1 is correct, while dumpcse has hte bug, this looks like a CSE bug, the replacement happens in the ReplaceOpWithCheaperOp() call in line 2387 of SDCCcse.c.

    Philipp

     

    Last edit: Philipp Klaus Krause 2018-03-12
  • Philipp Klaus Krause

    • Category: other --> redundancy elimination
     
  • Erik Petrich

    Erik Petrich - 2018-06-13
    • status: open --> closed-fixed
    • assigned_to: Erik Petrich
     
  • Erik Petrich

    Erik Petrich - 2018-06-13

    Fixed in [r10441]

     

Log in to post a comment.

MongoDB Logo MongoDB