Menu

#2559 Wrong operand in left shift by literal

closed-fixed
None
other
7
2017-01-13
2016-10-25
No

In sdcc 3.6.3 #9791, I see a wrong operand used in a left shift by a literal. I compiled for stm8.

Philipp

Discussion

  • Philipp Klaus Krause

    Here is a test case (obtained by using the LLVM+SDCC toolchain on the swap regression test and simplifying the result).

    Philipp

     
  • Philipp Klaus Krause

    • Priority: 5 --> 7
     
  • Philipp Klaus Krause

    In the generated asm, both iTemp3 and iTemp6 are at the same stack location.

    Philipp

     

    Last edit: Philipp Klaus Krause 2016-11-17
  • Philipp Klaus Krause

    After looking at this a bit further,Inoticed that the problem only happens when using the btree-based stack allocator.

    Philipp

     
  • Philipp Klaus Krause

    The btree-based stack allocator thinks that iTemp3 is declared in a different basic block from iTemp6, and they thus cannot overlap.
    There seem to be a lot of blocks around for such s short function; I guess they came from inlining somehow.

    Philipp

     
  • Philipp Klaus Krause

    At dumpraw1 iTemp3 and iTemp6 do not yet overlap, but they already do at dumpcse. Looks like the information about the basic blocks does not get updated correctly in cse.

    Philipp

     
  • Philipp Klaus Krause

    Maybe someone more familiar with inline and cse should have a look. I'm not sure if the information on blocks should be handled differently in inlining or in cse.

    Philipp

     
  • Erik Petrich

    Erik Petrich - 2017-01-13
    • status: open --> closed-fixed
    • assigned_to: Erik Petrich
     
  • Erik Petrich

    Erik Petrich - 2017-01-13

    Fixed in [r9833], I think. The block numbers in the AST and variable declarations now look okay to me. The main problem seems to have been that the compiler generated temporary used to hold the inlined function return value had a block number from inside the inlined function even though it would need to be used outside the function as well.

     

Log in to post a comment.