public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/114291] New: -fcompare-debug failure (length) with -fprofile-use at -O0
@ 2024-03-09 12:05 acoplan at gcc dot gnu.org
  2024-03-09 22:24 ` [Bug gcov-profile/114291] " pinskia at gcc dot gnu.org
  2024-03-09 22:28 ` [Bug middle-end/114291] " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: acoplan at gcc dot gnu.org @ 2024-03-09 12:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114291
           Summary: -fcompare-debug failure (length) with -fprofile-use at
                    -O0
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following is an -fcompare-debug failure that shows up with PGO (here on
aarch64-linux-gnu):

$ cat t.c
void foo() {}
int main(void) {}
$ gcc t.c -fprofile-generate
$ ./a.out
$ gcc t.c -fprofile-use -fcompare-debug
gcc: error: t.c: ‘-fcompare-debug’ failure (length)

The difference seems to be as follows:

$ gcc t.c -fprofile-use -fdump-final-insns=nodebug.final
$ gcc t.c -fprofile-use -g -fcompare-debug-second
-fdump-final-insns=debug.final
$ diff -u nodebug.final debug.final
--- nodebug.final       2024-03-09 12:00:43.875729773 +0000
+++ debug.final 2024-03-09 12:00:52.555650670 +0000
@@ -1,5 +1,6 @@

-;; Function foo (foo, funcdef_no=0, decl_uid=4426, cgraph_uid=1,
symbol_order=0) (unlikely executed)
+
+;; Function foo (foo, funcdef_no=0, cgraph_uid=1, symbol_order=0) (unlikely
executed)

 (note # 0 0 NOTE_INSN_DELETED)
 (note # 0 0 NOTE_INSN_PROLOGUE_END)
@@ -18,7 +19,10 @@
 (barrier # 0 0)
 (note # 0 0 NOTE_INSN_DELETED)

-;; Function main (main, funcdef_no=1, decl_uid=4429, cgraph_uid=2,
symbol_order=1)
+Declarations used by main, sorted by DECL_UID:
+0:   void <L0>;
+
+;; Function main (main, funcdef_no=1, cgraph_uid=2, symbol_order=1)

 (note # 0 0 NOTE_INSN_DELETED)
 (note # 0 0 [bb 2] NOTE_INSN_BASIC_BLOCK)

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

* [Bug gcov-profile/114291] -fcompare-debug failure (length) with -fprofile-use at -O0
  2024-03-09 12:05 [Bug middle-end/114291] New: -fcompare-debug failure (length) with -fprofile-use at -O0 acoplan at gcc dot gnu.org
@ 2024-03-09 22:24 ` pinskia at gcc dot gnu.org
  2024-03-09 22:28 ` [Bug middle-end/114291] " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-09 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
`Declarations used by main, sorted by DECL_UID` is printed by
dump_enumerated_decls

Which is caused by execute_cleanup_cfg_post_optimizing :
```
  if ((flag_compare_debug_opt || flag_compare_debug)
      && flag_dump_final_insns)
    {
...
          flag_dump_noaddr = flag_dump_unnumbered = 1;
          fprintf (final_output, "\n");
          dump_enumerated_decls (final_output,
                                 dump_flags | TDF_SLIM | TDF_NOUID);
          flag_dump_noaddr = save_noaddr;
          flag_dump_unnumbered = save_unnumbered;
```

That looks fine.

But I don't get why L0 is there in the -g case but not there without ...

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

* [Bug middle-end/114291] -fcompare-debug failure (length) with -fprofile-use at -O0
  2024-03-09 12:05 [Bug middle-end/114291] New: -fcompare-debug failure (length) with -fprofile-use at -O0 acoplan at gcc dot gnu.org
  2024-03-09 22:24 ` [Bug gcov-profile/114291] " pinskia at gcc dot gnu.org
@ 2024-03-09 22:28 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-09 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gcov-profile                |middle-end

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect the issue is dump_enumerated_decls is not skipping GIMPLE_LABEL as
GIMPLE_LABEL does not effect different code generation only additional labels
and at -O0 GCC emits extra labels for better debug info.

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

end of thread, other threads:[~2024-03-09 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-09 12:05 [Bug middle-end/114291] New: -fcompare-debug failure (length) with -fprofile-use at -O0 acoplan at gcc dot gnu.org
2024-03-09 22:24 ` [Bug gcov-profile/114291] " pinskia at gcc dot gnu.org
2024-03-09 22:28 ` [Bug middle-end/114291] " pinskia 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).