Actuall seems to work here.
test.c
int foobar()
{
int foo = 8;
int bar = 9;
return foo + bar;
}
gcc -Wa,-adhln -g -O3 -c test.c > test-mixed.c
1 .file "test.c"
9 .Ltext0:
10 .align 2
11 .globl foobar
13 foobar:
14 .LFB2:
15 .file 1 "test.c"
1:test.c **** int foobar()
2:test.c **** {
16 .loc 1 2 0
3:test.c **** int foo = 8;
4:test.c **** int bar = 9;
5:test.c ****
6:test.c **** return foo + bar;
7:test.c **** }
17 .loc 1 7 0
18 0000 38600011 li %r3,17
19 0004 4E800020 blr
20 .LFE2:
46 .Letext0:
Or is that not what you expect?
[edit]
My exsmple was abit trivial so the optimiser removed most of the code with no optrimsiation you get
1 .file "test.c"
9 .Ltext0:
10 .align 2
11 .globl foobar
13 foobar:
14 .LFB2:
15 .file 1 "test.c"
1:test.c **** int foobar()
2:test.c **** {
16 .loc 1 2 0
17 0000 9421FFE0 stwu %r1,-32(%r1)
18 .LCFI0:
19 0004 93E1001C stw %r31,28(%r1)
20 .LCFI1:
21 0008 7C3F0B78 mr %r31,%r1
22 .LCFI2:
3:test.c **** int foo = 8;
23 .loc 1 3 0
24 000c 38000008 li %r0,8
25 0010 901F000C stw %r0,12(%r31)
4:test.c **** int bar = 9;
26 .loc 1 4 0
27 0014 38000009 li %r0,9
28 0018 901F0008 stw %r0,8(%r31)
5:test.c ****
6:test.c **** return foo + bar;
29 .loc 1 6 0
30 001c 813F000C lwz %r9,12(%r31)
31 0020 801F0008 lwz %r0,8(%r31)
32 0024 7C090214 add %r0,%r9,%r0
7:test.c **** }
33 .loc 1 7 0
34 0028 7C030378 mr %r3,%r0
35 002c 81610000 lwz %r11,0(%r1)
36 0030 83EBFFFC lwz %r31,-4(%r11)
37 0034 7D615B78 mr %r1,%r11
38 0038 4E800020 blr
39 .LFE2:
77 .Letext0:
This was with gcc 4.2.4 from the SDK.