mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
run branch fixer again after replacing BRA by JMP. should fix #1936
This commit is contained in:
parent
299f764c5d
commit
ddab16007a
@ -850,6 +850,10 @@ static unsigned RunOptGroup7 (CodeSeg* S)
|
||||
C += RunOptFunc (S, &DOptJumpCascades, 1);
|
||||
C += RunOptFunc (S, &DOptBranchDist2, 1);
|
||||
|
||||
/* Adjust branch distances again, since the previous step may change code
|
||||
between branches */
|
||||
C += RunOptFunc (S, &DOptBranchDist, 3);
|
||||
|
||||
Changes += C;
|
||||
/* If we had changes, we must run dead code elimination again,
|
||||
** since the changes may have introduced dead code.
|
||||
|
93
test/misc/bug1936.c
Normal file
93
test/misc/bug1936.c
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
/* bug #1936 - Compiler produces broken Assembly (129 operand for bne) */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static uint8_t item_counter;
|
||||
|
||||
|
||||
static uint8_t freeze;
|
||||
static uint8_t powerUp;
|
||||
|
||||
static uint8_t wall_appeared;
|
||||
static uint8_t freeze_locked;
|
||||
static uint8_t zombie_locked;
|
||||
|
||||
|
||||
struct ItemStruct
|
||||
{
|
||||
uint8_t _active;
|
||||
void(*_effect)(void);
|
||||
} ;
|
||||
typedef struct ItemStruct Item;
|
||||
|
||||
static Item freezeItem;
|
||||
static Item powerUpItem;
|
||||
static Item wallItem;
|
||||
static Item zombieItem;
|
||||
|
||||
|
||||
static Item extraPointsItem[1];
|
||||
|
||||
|
||||
uint8_t find_inactive(Item* itemArray)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void drop_item(register Item *item, uint8_t max_counter)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void handle_item_drop(void)
|
||||
{
|
||||
{
|
||||
if(item_counter==1)
|
||||
{
|
||||
if(!powerUpItem._active)
|
||||
{
|
||||
drop_item(&powerUpItem,35);
|
||||
}
|
||||
}
|
||||
else if((!freeze_locked)&&(!freeze))
|
||||
{
|
||||
if(!freezeItem._active)
|
||||
{
|
||||
drop_item(&freezeItem,45);
|
||||
}
|
||||
}
|
||||
else if(!wall_appeared&&(powerUp>=9))
|
||||
{
|
||||
if(!wallItem._active)
|
||||
{
|
||||
drop_item(&wallItem,35);
|
||||
}
|
||||
}
|
||||
else if(!zombie_locked && !zombieItem._active)
|
||||
{
|
||||
drop_item(&zombieItem,50);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t index;
|
||||
|
||||
index = find_inactive(extraPointsItem);
|
||||
if(index!=1) // REMARK: compilation does not fail with 0
|
||||
{
|
||||
drop_item(&extraPointsItem[index],90);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
while(1) // Game (re-)start
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user