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

--- Comment #2 from Qirun Zhang <qrzhang at gatech dot edu> ---
(In reply to Andrew Pinski from comment #1)
> What is happening is the empty loop is being removed and not replaced with a
> debug statement say i is 6 afterwards.  I don't know if this is a good idea
> to put a debug statement here or not.

Agreed.
Nevertheless, it should not print a wrong value.
The expected behavior is "<optimized out>" like  what gcc-6.5.0 does as
follows:


$ gcc-6 -O3 out.c abc.c -g
$ gdb-trunk -x cmds -batch a.out
Breakpoint 1 at 0x547: file abc.c, line 8.

Breakpoint 1, main () at abc.c:8
8         optimize_me_not();
$1 = <optimized out>
Kill the program being debugged? (y or n) [answered Y; input not from terminal]
[Inferior 1 (process 17644) killed]

Reply via email to