This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/14041] New: H8300-elf unaligned word/longword access of zero initialized variables


Try code below with h8300-elf toolchain

----------------bug.c ---------------------

typedef struct {
	char a;
	char b;
}S1;

typedef struct {
	S1 d;
	void* ptr;
}S2;

static char tmp[1] = {0};
S2 test[1] = {0};

char func(S1 st) {}

int main() 
{
	return( func(test[1].d) );
}


----------------bug.c ---------------------

Compile with 

h8300-elf-gcc -ms -O2 bug.c

The dump with
h8300-elf-objdump -d a.out 

shows 

00000202 <_main>:
     202:       01 00 6d f6     01 00 6d f6       mov.l er6,@-er7
     206:       0f f6           0f f6             mov.l er7,er6
     208:       6b 20 00 00     6b 20 00 00 1e f1 mov.w @0x1ef1:32,r0 ******
     20c:       1e f1
     20e:       17 70           17 70             extu.l        er0
     210:       5e 00 01 f2     5e 00 01 f2       jsr   @0x1f2:0
     214:       17 50           17 50             extu.w        r0
     216:       01 00 6d 76     01 00 6d 76       mov.l @er7+,er6
     21a:       54 70           54 70             rts

The instruction 
     208:       6b 20 00 00     6b 20 00 00 1e f1 mov.w @0x1ef1:32,r0

has unaligned word access.

-- 
           Summary: H8300-elf unaligned word/longword access of zero
                    initialized variables
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dhananjayd at kpitcummins dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: h8300-unknown-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14041


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]