bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/12494] Relaxation leads to wrong code optimization (computed got


From: anitha.boyapati at atmel dot com
Subject: [Bug ld/12494] Relaxation leads to wrong code optimization (computed goto)
Date: Sat, 12 Mar 2011 08:35:20 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=12494

Anitha Boyapati <anitha.boyapati at atmel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anitha.boyapati at atmel
                   |                            |dot com

--- Comment #4 from Anitha Boyapati <anitha.boyapati at atmel dot com> 
2011-03-12 08:35:04 UTC ---
(In reply to comment #2)
> Created attachment 5249 [details]
> Disassembly
> 
> The wrong relaxation optimization. Note that fa gets called no matter what
> value parameter x of fb has.
> 
> Disassembly as of
> avr-objdump -z -h -S -j .data -j .text computed-goto.elf > computed-goto.lst


If label 'b' is not empty, I think this will not happen. I just tried a small
change. Lets say:

<code>
 goto *l[x];

 a:fa();
 b: z--;
</code>

The code generated will be :
...
8e:   09 94           ijmp
90:   e9 df           rcall   .-46            ; 0x64 <fa>
92:   80 91 64 00     lds     r24, 0x0064
96:   81 50           subi    r24, 0x01       ; 1
98:   80 93 64 00     sts     0x0064, r24
9c:   08 95           ret
...


(In reply to comment #1)
> Created attachment 5248 [details]
> .s as compiled by avr-gcc
> 
> avr-gcc output according to GNU-C source

Also, I find it a little strange that 2 ret are emitted in fb()

    ijmp
.L6:
    rcall fa     ; 
    ret
.L7:
    ret


Although it does not make any semantic difference why 2 return statements?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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