https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38534

--- Comment #36 from Lukas Grätz <[email protected]> ---
(In reply to Jakub Jelinek from comment #35)
> If I hand edit the gcc trunk + PR114116 patch assembly, add to bar
> +     .cfi_undefined 3
> +     .cfi_undefined 12
> +     .cfi_undefined 13
> +     .cfi_undefined 14
> +     .cfi_undefined 15
> then bt in gdb shows
> #2  0x00000000004011d2 in baz (a=a@entry=42, b=b@entry=43, c=c@entry=44,
> d=<error reading variable: value has been optimized out>, 
>     e=<error reading variable: value has been optimized out>, f=<error
> reading variable: value has been optimized out>, g=48, h=49) at /tmp/1.c:38


I can confirm that. What bothers me, is the wording "d=<error .... optimized
out>" and not just "d=<optimized out>".


(gdb) run
Starting program: bar-artificial-mod 

Program received signal SIGABRT, Aborted.

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7dcd859 in __GI_abort () at abort.c:79
#2  0x00000000004011b1 in bar () at bar-artificial.c:30
#3  0x00000000004011d2 in baz (a=a@entry=42, b=b@entry=43, c=c@entry=44,
d=<error reading variable: value has been optimised out>,
e=<error reading variable: value has been optimised out>,
f=<error reading variable: value has been optimised out>,
g=48, h=49) at bar-artificial.c:38
#4  0x00000000004012aa in qux () at bar-artificial.c:55
#5  0x00000000004012e4 in main () at bar-artificial.c:62

(gdb) p a
No symbol "a" in current context.
(gdb) p b
No symbol "b" in current context.


> and everything in qux live across the call is <optimized out> as well,
> (gdb) p $r12
> $10 = <not saved>
> etc. while without that
> (gdb) p a
> $1 = <optimized out>
> (gdb) p b
> $2 = <optimized out>
> (gdb) p c
> $3 = <optimized out>
> (gdb) p d
> $4 = -559038737
> (gdb) p e
> $5 = -559038737
> (gdb) p f
> $6 = -559038737
> (gdb) p g
> $7 = -559038737
> (gdb) p h
> $8 = -559038737
> (gdb) p $r12
> $9 = 3735928559


Where did you set the breakpoint? When I set it somewhere in qux (after
a,b,c,... were initialized), I get conclusive results:


(gdb) break bar-artificial.c:52
Breakpoint 1 at 0x40124a: file bar-artificial.c, line 52.
(gdb) run
Breakpoint 1, qux () at bar-artificial.c:52
52        corge (__builtin_alloca (foo (52)));
(gdb) p a
$1 = 42
(gdb) p b
$2 = 43
(gdb) p c
$3 = 44
(gdb) p d
$4 = 45
(gdb) p e 
$5 = 46
(gdb) p f
$6 = 47
(gdb) p g
$7 = 48
(gdb) p h
$8 = 49
(gdb) p $r12
$9 = 46

Reply via email to