public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3
@ 2021-05-06 23:16 cnsun at uwaterloo dot ca
  2021-05-06 23:35 ` [Bug tree-optimization/100464] [11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-06 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100464
           Summary: emitted binary code changes when -g is enabled at -O3
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

For the following program, when I turn on and off the flag '-g', the emitted
binary code by gcc-trunk is difference.


$ cat small.c
int *a;
static int b, c, d, e, g, h;
int f;
void i() {
  int *j[] = {&e, &b, &b, &d, &b, &b, &g, &e, &g, &b, &b,
              &b, &b, &g, &e, &e, &b, &b, &d, &b, &b, &e,
              &e, &g, &b, &b, &b, &b, &g, &e, &g, &c, &e};
  int **k = &j[5];
  for (; f;)
    b |= *a;
  *k = &h;
}
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.PQ1fNP1RKJ-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210506 (experimental) [master revision
:60f7b28fb:e1fcf14f33e4f371aae8ae497ca58a760d53ca6d] (GCC)
$
$ gcc-trunk small.c -O3 -w ; objdump --disassemble a.out > "no-g.txt"
$ gcc-trunk small.c -O3 -w -g ; objdump --disassemble a.out > "g.txt"
$ diff no-g.txt g.txt
35,36c35,36
<   401043:     49 c7 c0 b0 11 40 00    mov    $0x4011b0,%r8
<   40104a:     48 c7 c1 40 11 40 00    mov    $0x401140,%rcx
---
>   401043:     49 c7 c0 d0 11 40 00    mov    $0x4011d0,%r8
>   40104a:     48 c7 c1 60 11 40 00    mov    $0x401160,%rcx
108,156c108,162
<   401128:     74 06                   je     401130 <i+0x10>
<   40112a:     eb fe                   jmp    40112a <i+0xa>
<   40112c:     0f 1f 40 00             nopl   0x0(%rax)
<   401130:     c3                      retq
<   401131:     66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
<   401138:     00 00 00
<   40113b:     0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
<
< 0000000000401140 <__libc_csu_init>:
<   401140:     f3 0f 1e fa             endbr64
<   401144:     41 57                   push   %r15
<   401146:     4c 8d 3d f3 2c 00 00    lea    0x2cf3(%rip),%r15        #
403e40 <__frame_dummy_init_array_entry>
<   40114d:     41 56                   push   %r14
<   40114f:     49 89 d6                mov    %rdx,%r14
<   401152:     41 55                   push   %r13
<   401154:     49 89 f5                mov    %rsi,%r13
<   401157:     41 54                   push   %r12
<   401159:     41 89 fc                mov    %edi,%r12d
<   40115c:     55                      push   %rbp
<   40115d:     48 8d 2d e4 2c 00 00    lea    0x2ce4(%rip),%rbp        #
403e48 <__do_global_dtors_aux_fini_array_entry>
<   401164:     53                      push   %rbx
<   401165:     4c 29 fd                sub    %r15,%rbp
<   401168:     48 83 ec 08             sub    $0x8,%rsp
<   40116c:     e8 8f fe ff ff          callq  401000 <_init>
<   401171:     48 c1 fd 03             sar    $0x3,%rbp
<   401175:     74 1f                   je     401196 <__libc_csu_init+0x56>
<   401177:     31 db                   xor    %ebx,%ebx
<   401179:     0f 1f 80 00 00 00 00    nopl   0x0(%rax)
<   401180:     4c 89 f2                mov    %r14,%rdx
<   401183:     4c 89 ee                mov    %r13,%rsi
<   401186:     44 89 e7                mov    %r12d,%edi
<   401189:     41 ff 14 df             callq  *(%r15,%rbx,8)
<   40118d:     48 83 c3 01             add    $0x1,%rbx
<   401191:     48 39 dd                cmp    %rbx,%rbp
<   401194:     75 ea                   jne    401180 <__libc_csu_init+0x40>
<   401196:     48 83 c4 08             add    $0x8,%rsp
<   40119a:     5b                      pop    %rbx
<   40119b:     5d                      pop    %rbp
<   40119c:     41 5c                   pop    %r12
<   40119e:     41 5d                   pop    %r13
<   4011a0:     41 5e                   pop    %r14
<   4011a2:     41 5f                   pop    %r15
<   4011a4:     c3                      retq
<   4011a5:     66 66 2e 0f 1f 84 00    data16 nopw %cs:0x0(%rax,%rax,1)
<   4011ac:     00 00 00 00
<
< 00000000004011b0 <__libc_csu_fini>:
<   4011b0:     f3 0f 1e fa             endbr64
<   4011b4:     c3                      retq
---
>   401128:     74 26                   je     401150 <i+0x30>
>   40112a:     48 8b 15 07 2f 00 00    mov    0x2f07(%rip),%rdx        # 404038 <a>
>   401131:     8b 05 09 2f 00 00       mov    0x2f09(%rip),%eax        # 404040 <b>
>   401137:     66 0f 1f 84 00 00 00    nopw   0x0(%rax,%rax,1)
>   40113e:     00 00
>   401140:     0b 02                   or     (%rdx),%eax
>   401142:     89 05 f8 2e 00 00       mov    %eax,0x2ef8(%rip)        # 404040 <b>
>   401148:     eb f6                   jmp    401140 <i+0x20>
>   40114a:     66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
>   401150:     c3                      retq
>   401151:     66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
>   401158:     00 00 00
>   40115b:     0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
>
> 0000000000401160 <__libc_csu_init>:
>   401160:     f3 0f 1e fa             endbr64
>   401164:     41 57                   push   %r15
>   401166:     4c 8d 3d d3 2c 00 00    lea    0x2cd3(%rip),%r15        # 403e40 <__frame_dummy_init_array_entry>
>   40116d:     41 56                   push   %r14
>   40116f:     49 89 d6                mov    %rdx,%r14
>   401172:     41 55                   push   %r13
>   401174:     49 89 f5                mov    %rsi,%r13
>   401177:     41 54                   push   %r12
>   401179:     41 89 fc                mov    %edi,%r12d
>   40117c:     55                      push   %rbp
>   40117d:     48 8d 2d c4 2c 00 00    lea    0x2cc4(%rip),%rbp        # 403e48 <__do_global_dtors_aux_fini_array_entry>
>   401184:     53                      push   %rbx
>   401185:     4c 29 fd                sub    %r15,%rbp
>   401188:     48 83 ec 08             sub    $0x8,%rsp
>   40118c:     e8 6f fe ff ff          callq  401000 <_init>
>   401191:     48 c1 fd 03             sar    $0x3,%rbp
>   401195:     74 1f                   je     4011b6 <__libc_csu_init+0x56>
>   401197:     31 db                   xor    %ebx,%ebx
>   401199:     0f 1f 80 00 00 00 00    nopl   0x0(%rax)
>   4011a0:     4c 89 f2                mov    %r14,%rdx
>   4011a3:     4c 89 ee                mov    %r13,%rsi
>   4011a6:     44 89 e7                mov    %r12d,%edi
>   4011a9:     41 ff 14 df             callq  *(%r15,%rbx,8)
>   4011ad:     48 83 c3 01             add    $0x1,%rbx
>   4011b1:     48 39 dd                cmp    %rbx,%rbp
>   4011b4:     75 ea                   jne    4011a0 <__libc_csu_init+0x40>
>   4011b6:     48 83 c4 08             add    $0x8,%rsp
>   4011ba:     5b                      pop    %rbx
>   4011bb:     5d                      pop    %rbp
>   4011bc:     41 5c                   pop    %r12
>   4011be:     41 5d                   pop    %r13
>   4011c0:     41 5e                   pop    %r14
>   4011c2:     41 5f                   pop    %r15
>   4011c4:     c3                      retq
>   4011c5:     66 66 2e 0f 1f 84 00    data16 nopw %cs:0x0(%rax,%rax,1)
>   4011cc:     00 00 00 00
>
> 00000000004011d0 <__libc_csu_fini>:
>   4011d0:     f3 0f 1e fa             endbr64
>   4011d4:     c3                      retq
160,164c166,170
< 00000000004011b8 <_fini>:
<   4011b8:     f3 0f 1e fa             endbr64
<   4011bc:     48 83 ec 08             sub    $0x8,%rsp
<   4011c0:     48 83 c4 08             add    $0x8,%rsp
<   4011c4:     c3                      retq
---
> 00000000004011d8 <_fini>:
>   4011d8:     f3 0f 1e fa             endbr64
>   4011dc:     48 83 ec 08             sub    $0x8,%rsp
>   4011e0:     48 83 c4 08             add    $0x8,%rsp
>   4011e4:     c3                      retq

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
@ 2021-05-06 23:35 ` pinskia at gcc dot gnu.org
  2021-05-07  7:22 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-06 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
          Component|c                           |tree-optimization
     Ever confirmed|0                           |1
            Summary|emitted binary code changes |[11/12 Regression] emitted
                   |when -g is enabled at -O3   |binary code changes when -g
                   |                            |is enabled at -O3
   Last reconfirmed|                            |2021-05-06
             Status|UNCONFIRMED                 |NEW
            Version|unknown                     |12.0
   Target Milestone|---                         |11.2
      Known to work|                            |7.5.0
      Known to fail|                            |11.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, the problem shows up in lim2.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
  2021-05-06 23:35 ` [Bug tree-optimization/100464] [11/12 Regression] " pinskia at gcc dot gnu.org
@ 2021-05-07  7:22 ` rguenth at gcc dot gnu.org
  2021-05-07  7:51 ` rguenth at gcc dot gnu.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-07  7:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
           Keywords|wrong-code                  |
             Status|NEW                         |ASSIGNED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
  2021-05-06 23:35 ` [Bug tree-optimization/100464] [11/12 Regression] " pinskia at gcc dot gnu.org
  2021-05-07  7:22 ` rguenth at gcc dot gnu.org
@ 2021-05-07  7:51 ` rguenth at gcc dot gnu.org
  2021-05-07  8:12 ` jakub at gcc dot gnu.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-07  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the difference is that 'b' is TREE_ADDRESSABLE with -g but not without.

in forwprop2 we do

-  # DEBUG j$40 => MEM <int *> [(int *[33] *)&*.LC0{&} + 40B]
+  # DEBUG j$40 => &b{&}

and that makes b TREE_ADDRESSABLE which happens in

tree
canonicalize_constructor_val (tree cval, tree from_decl)
{
...
      if (VAR_P (base))
        TREE_ADDRESSABLE (base) = 1;

which was added in r181197 as to fix "Java early folding".  I'll test removing
that (it should assert the addressable flag is set, but _not_ when we're
ultimatively coming from a debug stmt which means it'll be awkward to keep).

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2021-05-07  7:51 ` rguenth at gcc dot gnu.org
@ 2021-05-07  8:12 ` jakub at gcc dot gnu.org
  2021-05-07 13:22 ` cnsun at uwaterloo dot ca
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-07  8:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or pass from_debug to it.
Started with r11-1146-g1396fa5b91cfa0b3708ec9df33c0bb84386081d6
(though maybe latent before that).

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2021-05-07  8:12 ` jakub at gcc dot gnu.org
@ 2021-05-07 13:22 ` cnsun at uwaterloo dot ca
  2021-05-07 13:27 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-07 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
I have a question. If the test program has undefined behaviors, is GCC still
expected to emit the same binary code for compilation with and without debug
symbols? 

Thanks.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (4 preceding siblings ...)
  2021-05-07 13:22 ` cnsun at uwaterloo dot ca
@ 2021-05-07 13:27 ` jakub at gcc dot gnu.org
  2021-05-07 13:28 ` cnsun at uwaterloo dot ca
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-07 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yes.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (5 preceding siblings ...)
  2021-05-07 13:27 ` jakub at gcc dot gnu.org
@ 2021-05-07 13:28 ` cnsun at uwaterloo dot ca
  2021-05-07 13:36 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-07 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
(In reply to Jakub Jelinek from comment #6)
> Yes.

Great. Thanks. We have a bunch of such test programs. I will report them
shortly.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (6 preceding siblings ...)
  2021-05-07 13:28 ` cnsun at uwaterloo dot ca
@ 2021-05-07 13:36 ` jakub at gcc dot gnu.org
  2021-05-07 13:38 ` cnsun at uwaterloo dot ca
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-07 13:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
gcc has the -fcompare-debug option, which compiles twice, once with -g and once
with -g -gtoggle and compares result, anything that fails with that option with
an error about debug vs. non-debug differences or potential differences is a
bug.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (7 preceding siblings ...)
  2021-05-07 13:36 ` jakub at gcc dot gnu.org
@ 2021-05-07 13:38 ` cnsun at uwaterloo dot ca
  2021-05-10  9:42 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-07 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
Thanks for the tip. We will use that flag.

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

* [Bug tree-optimization/100464] [11/12 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (8 preceding siblings ...)
  2021-05-07 13:38 ` cnsun at uwaterloo dot ca
@ 2021-05-10  9:42 ` cvs-commit at gcc dot gnu.org
  2021-05-10  9:46 ` [Bug tree-optimization/100464] [11 " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-10  9:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:a076632e274abe344ca7648b7c7f299273d4cbe0

commit r12-657-ga076632e274abe344ca7648b7c7f299273d4cbe0
Author: Richard Biener <rguenther@suse.de>
Date:   Fri May 7 09:51:18 2021 +0200

    middle-end/100464 - avoid spurious TREE_ADDRESSABLE in folding debug stmts

    canonicalize_constructor_val was setting TREE_ADDRESSABLE on bases
    of ADDR_EXPRs but that's futile when we're dealing with CTOR values
    in debug stmts.  This rips out the code which was added for Java
    and should have been an assertion when we didn't have debug stmts.
    To not regress g++.dg/tree-ssa/array-temp1.C we have to adjust the
    testcase to not look for a no longer applied invalid optimization.

    2021-05-10  Richard Biener  <rguenther@suse.de>

            PR middle-end/100464
            PR c++/100468
    gcc/
            * gimple-fold.c (canonicalize_constructor_val): Do not set
            TREE_ADDRESSABLE.

    gcc/cp/
            * call.c (set_up_extended_ref_temp): Mark the temporary
            addressable if the TARGET_EXPR was.

    gcc/testsuite/
            * gcc.dg/pr100464.c: New testcase.
            * g++.dg/tree-ssa/array-temp1.C: Adjust.

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (9 preceding siblings ...)
  2021-05-10  9:42 ` cvs-commit at gcc dot gnu.org
@ 2021-05-10  9:46 ` rguenth at gcc dot gnu.org
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-10  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|11.0                        |11.1.0
            Summary|[11/12 Regression] emitted  |[11 Regression] emitted
                   |binary code changes when -g |binary code changes when -g
                   |is enabled at -O3           |is enabled at -O3
      Known to work|                            |12.0

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.  Let's watch the fireworks.

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (10 preceding siblings ...)
  2021-05-10  9:46 ` [Bug tree-optimization/100464] [11 " rguenth at gcc dot gnu.org
@ 2021-07-28  7:06 ` rguenth at gcc dot gnu.org
  2021-10-13  5:13 ` cnsun at uwaterloo dot ca
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:06 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (11 preceding siblings ...)
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
@ 2021-10-13  5:13 ` cnsun at uwaterloo dot ca
  2021-10-13  7:39 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-10-13  5:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
(In reply to Jakub Jelinek from comment #8)
> gcc has the -fcompare-debug option, which compiles twice, once with -g and
> once with -g -gtoggle and compares result, anything that fails with that
> option with an error about debug vs. non-debug differences or potential
> differences is a bug.

Hi Jakub,

Is the following flag is correct usage of -fcompare-debug?

    $ gcc -fcompare-debug -O3 t.c

Also, what is the output or the exit code if gcc finds an inconsistency in
debug info? Is there an internal compiler error?

Thanks.

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (12 preceding siblings ...)
  2021-10-13  5:13 ` cnsun at uwaterloo dot ca
@ 2021-10-13  7:39 ` jakub at gcc dot gnu.org
  2021-10-13 15:54 ` cnsun at uwaterloo dot ca
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-10-13  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yes.  You'll get an error, like:
error: t.c: ‘-fcompare-debug’ failure (length)
or
error: t.c: ‘-fcompare-debug’ failure
Under the hood, the driver invokes the compiler once with
the options you've given plus -fdump-final-insns=sometempfile1
and then also with the options you've given plus -gtoggle
-fcompare-debug-second -fdump-final-insns=sometempfile2 (and will throw away
stdout/stderr from the compiler).  The (length) failure means sometempfile1 and
sometempfile2 have different lengths, while the other error mean they have the
same length, but their content differs.

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (13 preceding siblings ...)
  2021-10-13  7:39 ` jakub at gcc dot gnu.org
@ 2021-10-13 15:54 ` cnsun at uwaterloo dot ca
  2022-02-18  9:29 ` cvs-commit at gcc dot gnu.org
  2022-02-18  9:29 ` rguenth at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-10-13 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
(In reply to Jakub Jelinek from comment #14)
> Yes.  You'll get an error, like:
> error: t.c: ‘-fcompare-debug’ failure (length)
> or
> error: t.c: ‘-fcompare-debug’ failure
> Under the hood, the driver invokes the compiler once with
> the options you've given plus -fdump-final-insns=sometempfile1
> and then also with the options you've given plus -gtoggle
> -fcompare-debug-second -fdump-final-insns=sometempfile2 (and will throw away
> stdout/stderr from the compiler).  The (length) failure means sometempfile1
> and sometempfile2 have different lengths, while the other error mean they
> have the same length, but their content differs.

Thank you.

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (14 preceding siblings ...)
  2021-10-13 15:54 ` cnsun at uwaterloo dot ca
@ 2022-02-18  9:29 ` cvs-commit at gcc dot gnu.org
  2022-02-18  9:29 ` rguenth at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-18  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:462900ba21f5fdf865c93f693083da3179dd3151

commit r11-9591-g462900ba21f5fdf865c93f693083da3179dd3151
Author: Richard Biener <rguenther@suse.de>
Date:   Fri May 7 09:51:18 2021 +0200

    middle-end/100464 - avoid spurious TREE_ADDRESSABLE in folding debug stmts

    canonicalize_constructor_val was setting TREE_ADDRESSABLE on bases
    of ADDR_EXPRs but that's futile when we're dealing with CTOR values
    in debug stmts.  This rips out the code which was added for Java
    and should have been an assertion when we didn't have debug stmts.
    To not regress g++.dg/tree-ssa/array-temp1.C we have to adjust the
    testcase to not look for a no longer applied invalid optimization.

    2021-05-10  Richard Biener  <rguenther@suse.de>

            PR middle-end/100464
            PR c++/100468
    gcc/
            * gimple-fold.c (canonicalize_constructor_val): Do not set
            TREE_ADDRESSABLE.

    gcc/cp/
            * call.c (set_up_extended_ref_temp): Mark the temporary
            addressable if the TARGET_EXPR was.

    gcc/testsuite/
            * gcc.dg/pr100464.c: New testcase.
            * g++.dg/tree-ssa/array-temp1.C: Adjust.

    (cherry picked from commit a076632e274abe344ca7648b7c7f299273d4cbe0)

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

* [Bug tree-optimization/100464] [11 Regression] emitted binary code changes when -g is enabled at -O3
  2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
                   ` (15 preceding siblings ...)
  2022-02-18  9:29 ` cvs-commit at gcc dot gnu.org
@ 2022-02-18  9:29 ` rguenth at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-18  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |11.2.0
         Resolution|---                         |FIXED
      Known to work|                            |11.2.1

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-02-18  9:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 23:16 [Bug c/100464] New: emitted binary code changes when -g is enabled at -O3 cnsun at uwaterloo dot ca
2021-05-06 23:35 ` [Bug tree-optimization/100464] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-05-07  7:22 ` rguenth at gcc dot gnu.org
2021-05-07  7:51 ` rguenth at gcc dot gnu.org
2021-05-07  8:12 ` jakub at gcc dot gnu.org
2021-05-07 13:22 ` cnsun at uwaterloo dot ca
2021-05-07 13:27 ` jakub at gcc dot gnu.org
2021-05-07 13:28 ` cnsun at uwaterloo dot ca
2021-05-07 13:36 ` jakub at gcc dot gnu.org
2021-05-07 13:38 ` cnsun at uwaterloo dot ca
2021-05-10  9:42 ` cvs-commit at gcc dot gnu.org
2021-05-10  9:46 ` [Bug tree-optimization/100464] [11 " rguenth at gcc dot gnu.org
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-10-13  5:13 ` cnsun at uwaterloo dot ca
2021-10-13  7:39 ` jakub at gcc dot gnu.org
2021-10-13 15:54 ` cnsun at uwaterloo dot ca
2022-02-18  9:29 ` cvs-commit at gcc dot gnu.org
2022-02-18  9:29 ` rguenth 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).