avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] wrong code from avr-gcc 4.1.2?


From: John Regehr
Subject: RE: [avr-gcc-list] wrong code from avr-gcc 4.1.2?
Date: Sun, 1 Jun 2008 22:28:11 -0600 (MDT)

Can you post the output using?: -O1 -dP

See below (but this isn't likely to be useful-- the function returns the correct result at -O1). Code is wrong at -Os, -O2, and -O3. Even further below is the compiler output for -Os -dP.

Thanks,

John



address@hidden tmp14]$ avr-gcc -O1 -dP -mmcu=atmega128 -fwrapv -S foo.c -o -
        .file   "foo.c"
        .arch atmega128
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
        .global __do_copy_data
        .global __do_clear_bss
        .text
.global func_1
        .type   func_1, @function
func_1:
/* prologue: frame size=0 */
/* prologue end (size=0) */
 ; (insn 16 9 22 (set (reg/i:HI 24 r24 [ <result> ])
 ;         (const_int 0 [0x0])) 12 {*movhi} (nil)
 ;     (nil))
        ldi r24,lo8(0)   ;  16  *movhi/4        [length = 2]
        ldi r25,hi8(0)
/* epilogue: frame size=0 */
        ret
/* epilogue end (size=1) */
/* function func_1 size 3 (2) */
        .size   func_1, .-func_1
        .comm g_66,4,1
        .comm g_73,4,1
/* File "foo.c": code 3 = 0x0003 ( 2), prologues 0, epilogues 1 */






address@hidden tmp14]$ avr-gcc -Os -dP -mmcu=atmega128 -fwrapv -S foo.c -o -
        .file   "foo.c"
        .arch atmega128
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
        .global __do_copy_data
        .global __do_clear_bss
        .text
.global func_1
        .type   func_1, @function
func_1:
/* prologue: frame size=0 */
/* prologue end (size=0) */
 ; (insn 16 9 22 (set (reg/i:HI 24 r24 [ <result> ])
 ;         (const_int 1 [0x1])) 12 {*movhi} (nil)
 ;     (nil))
        ldi r24,lo8(1)   ;  16  *movhi/4        [length = 2]
        ldi r25,hi8(1)
/* epilogue: frame size=0 */
        ret
/* epilogue end (size=1) */
/* function func_1 size 3 (2) */
        .size   func_1, .-func_1
        .comm g_66,4,1
        .comm g_73,4,1
/* File "foo.c": code 3 = 0x0003 ( 2), prologues 0, epilogues 1 */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]