Skip to content

Commit

Permalink
Isssue #1144: Rechecking tests revealed alignment error
Browse files Browse the repository at this point in the history
  • Loading branch information
suborb committed May 7, 2023
1 parent 3c289cd commit 1b10314
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/sccz80/declinit.c
Expand Up @@ -110,7 +110,7 @@ int str_init(Type *tag)

if ( rcmatch('.') && isalpha(line[lptr+1]) ) {
char declname[NAMESIZE];
int j, bfsize = ptr->offset;
int j, bfsize = ptr->size;
Type *ptr2 = NULL;


Expand All @@ -128,8 +128,9 @@ int str_init(Type *tag)
int skip = ptr2->offset - ptr->offset;
// We've found a symbol
needchar('=');

// Storage space
if ( skip > 0 ) {
if ( skip > 0 && had_bitfield == 0) {
defstorage(); outdec(skip); nl();
sz += skip;
}
Expand All @@ -147,14 +148,13 @@ int str_init(Type *tag)

if ( ptr->bit_size == 0 ) {
if ( had_bitfield ) {
sz = bfsize;
sz += bfsize;
// We've finished a byte/word of bitfield, we should dump it
outfmt("\t%s\t0x%x\n", had_bitfield <= 8 ? "defb" : "defw", bitfield_value);
had_bitfield = 0;
bitfield_value = 0;
}
}

}


Expand Down
2 changes: 0 additions & 2 deletions testsuite/results/Issue_1144_designated_init.opt
Expand Up @@ -9,10 +9,8 @@
SECTION data_compiler
._data
defs 4
defs 1
defb 0x1
defw i_1+0
defs 1
SECTION code_compiler
SECTION data_compiler
._data1
Expand Down

0 comments on commit 1b10314

Please sign in to comment.