public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100781] New: Emitted binary code changes when -g is enabled at -O2
@ 2021-05-26 21:12 tlwang at uwaterloo dot ca
  2021-05-26 21:30 ` [Bug tree-optimization/100781] [12 Regression] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: tlwang at uwaterloo dot ca @ 2021-05-26 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100781
           Summary: Emitted binary code changes when -g is enabled at -O2
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tlwang at uwaterloo dot ca
  Target Milestone: ---

The .text section for the following program (transformed_program0.c) changes
after toggling the -g flag. 

$ cat transformed_program0.c
struct a {
  int b;
};
long c(short d, long e, struct a f) {
g:;
  int h = f.b <= e, i = d, n = h >= d;
  if (!n)
    goto j;
  goto k;
j:;
  long l = 5;
  if (l)
    goto m;
  d = 0;
m:
  if (d)
    return f.b;
k:
  goto g;
}
int main() {}
$
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.tVhv2eaPzV-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210526 (experimental) [master revision
:21638bbbf:1fd76b24306ed4df4cf9e797d900699ed59ce7f7] (GCC)
$
$ gcc-trunk transformed_program0.c -O2 -w ; objdump --disassemble a.out >
"no-g.txt"
$ gcc-trunk transformed_program0.c -O2 -w -g; objdump --disassemble a.out >
"g.txt"
$ diff no-g.txt g.txt
108,111c108,111
<   401125:     89 f9                   mov    %edi,%ecx
<   401127:     0f bf ff                movswl %di,%edi
<   40112a:     49 39 f0                cmp    %rsi,%r8
<   40112d:     0f 9e c0                setle  %al
---
>   401125:	0f bf ff             	movswl %di,%edi
>   401128:	4c 39 c6             	cmp    %r8,%rsi
>   40112b:	0f 9d c0             	setge  %al
>   40112e:	66 90                	xchg   %ax,%ax
114,118c114,117
<   401134:     66 85 c9                test   %cx,%cx
<   401137:     74 f7                   je     401130 <c+0x10>
<   401139:     4c 89 c0                mov    %r8,%rax
<   40113c:     c3                      retq
<   40113d:     0f 1f 00                nopl   (%rax)
---
>   401134:	4c 89 c0             	mov    %r8,%rax
>   401137:	c3                   	retq
>   401138:	0f 1f 84 00 00 00 00 	nopl   0x0(%rax,%rax,1)
>   40113f:	00

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-07-14 21:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 21:12 [Bug tree-optimization/100781] New: Emitted binary code changes when -g is enabled at -O2 tlwang at uwaterloo dot ca
2021-05-26 21:30 ` [Bug tree-optimization/100781] [12 Regression] " pinskia at gcc dot gnu.org
2021-05-26 21:31 ` pinskia at gcc dot gnu.org
2021-05-26 21:33 ` pinskia at gcc dot gnu.org
2021-05-26 21:38 ` pinskia at gcc dot gnu.org
2021-05-27  6:20 ` aldyh at gcc dot gnu.org
2021-05-27 18:13 ` amacleod at redhat dot com
2021-06-01  1:32 ` cvs-commit at gcc dot gnu.org
2021-06-01  1:36 ` amacleod at redhat dot com
2021-06-01  1:36 ` amacleod at redhat dot com
2021-07-14 21:58 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).