#872 incorrect critical function prologues in hc08 port

hc08 port (43)

Parameterized functions marked as critical generate
incorrect prologues. When a function is marked as critical
the compiler copies the CCR to reg A and pushes it on the
stack before disabling interrupts. However, if a critical
function accepts arguments, then the first argument is
passed in reg A. Copying the CCR will overwrite the
argument in reg A.

Critical functions should not use reg A to pass arguments,
or a warning should be generated that critical functions
cannot have arguments.

In the attached example, test(a,b,c) is a critical function.
Argument 'a' is passed by saving it in reg A (line 135).
The first instruction of test(), tpa, overwrites this argument


  • Nobody/Anonymous

    Assembly listing demonstrating the overwriting of the first parameter in functions marked critical.

  • Nobody/Anonymous

    Logged In: NO

    Questions? lucas.fisher@XXXXXgmail.com

  • Erik Petrich

    Erik Petrich - 2005-01-31
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
  • Erik Petrich

    Erik Petrich - 2005-01-31

    Logged In: YES

    Fixed in src/hc08/gen.c 1.34 (sdcc version 2.4.8 #948)


Log in to post a comment.