Thread (1 message) 1 message, 1 author, 2012-09-11

GCC 4.6.x miscompiling arm-linux?

From: Matthew Leach <hidden>
Date: 2012-09-11 10:33:20

Michael Olbrich [off-list ref] writes:
quoted
Btw, Here's what I get from it:

flexcan_chip_start:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        @ link register save eliminated.
        mov     r3, #0
        cmp     r0, #9
        str     r3, [r1, #0]
        ldrle   r3, [r1, #4]
        mov     r0, #0
        str     r3, [r1, #4]
        bx      lr
        .size   flexcan_chip_start, .-flexcan_chip_start
        .ident  "GCC: (OSELAS.Toolchain-2011.11.1) 4.6.3"
        .section        .note.GNU-stack,"",%progbits
How can I reproduce this output? I'd like to test this with different
toolchain versions.
You can use this code fragment to produce the error:

/* Structure of the hardware registers */
struct flexcan_regs {
	unsigned int mcr;
	unsigned int rxfgmask;
};

#define flexcan_read(a) (*(volatile unsigned int *)(a))
#define flexcan_write(v,a)      (*(volatile unsigned int *)(a) = (v))

int flexcan_chip_start(int ver, struct flexcan_regs *regs)
{
	flexcan_write(0, &regs->mcr);

	if (ver >= 10)
		flexcan_write(0, &regs->rxfgmask);

	return 0;
}

Matt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help