public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
@ 2020-03-23 14:04 marxin at gcc dot gnu.org
  2020-03-23 14:04 ` [Bug debug/94281] [8/9/10 Regression] " marxin at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-23 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94281
           Summary: g++: error: hash.cpp: ‘-fcompare-debug’ failure
                    (length) since r8-5241-g8697bf9f46f36168
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: aoliva at gcc dot gnu.org
  Target Milestone: ---

Following fails:

$ cat hash.cpp
void fn1() {}
void fn2() { ; }

$ g++ hash.cpp -O1 -fno-tree-dce -fcompare-debug -fipa-icf -fno-tree-forwprop
g++: error: hash.cpp: ‘-fcompare-debug’ failure (length)

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
@ 2020-03-23 14:04 ` marxin at gcc dot gnu.org
  2020-03-23 15:23 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-23 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P2
   Last reconfirmed|                            |2020-03-23
            Summary|g++: error: hash.cpp:       |[8/9/10 Regression] g++:
                   |‘-fcompare-debug’ failure   |error: hash.cpp:
                   |(length) since              |‘-fcompare-debug’ failure
                   |r8-5241-g8697bf9f46f36168   |(length) since
                   |                            |r8-5241-g8697bf9f46f36168
      Known to work|                            |8.4.0
      Known to fail|                            |10.0, 9.3.0
     Ever confirmed|0                           |1

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
  2020-03-23 14:04 ` [Bug debug/94281] [8/9/10 Regression] " marxin at gcc dot gnu.org
@ 2020-03-23 15:23 ` rguenth at gcc dot gnu.org
  2020-03-24  9:02 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-23 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
  2020-03-23 14:04 ` [Bug debug/94281] [8/9/10 Regression] " marxin at gcc dot gnu.org
  2020-03-23 15:23 ` rguenth at gcc dot gnu.org
@ 2020-03-24  9:02 ` marxin at gcc dot gnu.org
  2020-03-24 10:17 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-24  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm taking this as I want to learn how to fix -fcompare-debug issues ;)

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-24  9:02 ` marxin at gcc dot gnu.org
@ 2020-03-24 10:17 ` marxin at gcc dot gnu.org
  2020-03-25 13:52 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-24 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                 CC|                            |jakub at gcc dot gnu.org
           Assignee|marxin at gcc dot gnu.org          |unassigned at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
It has something to do with end location of function:

$ cat hash.c
void fn1()
{
}
void fn2()
{
  ;
}

$ ./xg++ -B. -g hash.c -c -O1 -fno-tree-dce -fipa-icf -fno-tree-forwprop
-fdump-rtl-cmpelim=/dev/stdout
...
(note 2 3 5 2 NOTE_INSN_FUNCTION_BEG)
(debug_insn 5 2 8 2 (debug_marker) "hash.c":6:3 -1
     (nil))

$ ./xg++ -B. -g hash.c -c -O1 -fno-tree-dce -fipa-icf -fno-tree-forwprop
-fdump-rtl-pro_and_epilogue=/dev/stdout
...
(note 2 9 5 2 NOTE_INSN_FUNCTION_BEG)
(debug_insn 5 2 10 2 (debug_marker) "hash.c":6:3 -1
     (nil))
(note 10 5 11 2 NOTE_INSN_EPILOGUE_BEG)
(jump_insn 11 10 12 2 (simple_return) "hash.c":7:1 -1
     (nil)
 -> simple_return)

$ ./xg++ -B. -g hash.c -c -O1 -fno-tree-dce -fipa-icf -fno-tree-forwprop
-fdump-rtl-pro_and_epilogue=/dev/stdout -g0
...
(note 9 2 10 2 NOTE_INSN_EPILOGUE_BEG)
(jump_insn 10 9 11 2 (simple_return) "hash.c":4:6 -1
     (nil)
 -> simple_return)

So hash.c:4:6 is DECL_SOURCE_LOCATION while hash.c:7:1 is function_end_locus.
So maybe a bad source_location or maybe screwed by IPA ICF.

Anyway, leaving for now..

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-24 10:17 ` marxin at gcc dot gnu.org
@ 2020-03-25 13:52 ` jakub at gcc dot gnu.org
  2020-03-25 14:40 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-25 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48117
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48117&action=edit
gcc10-pr94281.patch

Untested fix.

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-03-25 13:52 ` jakub at gcc dot gnu.org
@ 2020-03-25 14:40 ` jakub at gcc dot gnu.org
  2020-03-26  9:11 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-25 14:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #48117|0                           |1
        is obsolete|                            |

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48118
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48118&action=edit
gcc10-pr94281.patch

While trying to simulate all the cases that the patch is meant to handle in the
debugger (i.e. also outer_stmt being a GIMPLE_BIND and some debug stmts before
and/or after that), I've discovered a bug in gimple_seq_last_nondebug_stmt
where it would return NULL on a gimple_seq containing the GIMPLE_BIND followed
by a DEBUG_BEGIN_STMT, while obviously it should return that GIMPLE_BIND
instead.
THis updated patch should fix that too.

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

* [Bug debug/94281] [8/9/10 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-03-25 14:40 ` jakub at gcc dot gnu.org
@ 2020-03-26  9:11 ` cvs-commit at gcc dot gnu.org
  2020-03-30 15:07 ` [Bug debug/94281] [8/9 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-26  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:10ea09ee846eaa345161a3a3f519b3780d6101fa

commit r10-7395-g10ea09ee846eaa345161a3a3f519b3780d6101fa
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Mar 26 10:10:21 2020 +0100

    gimplify: Fix -fcompare-debug differences caused by gimplify_body [PR94281]

    The following testcase FAILs, because gimplify_body adds a GIMPLE_NOP only
    when there are no statements in the function and with -g there is a
    DEBUG_BEGIN_STMT, so it doesn't add it and due to -fno-tree-dce that never
    gets removed afterwards.  Similarly, if the body seq after gimplification
    contains some DEBUG_BEGIN_STMTs plus a single gbind, then we could behave
    differently between -g0 and -g, by using that gbind as the body in the -g0
    case and not in the -g case.
    This patch fixes that by ignoring DEBUG_BEGIN_STMTs (other debug stmts
can't
    appear at this point yet thankfully) during decisions and if we pick the
    single gbind and there are DEBUG_BEGIN_STMTs next to it, it moves them into
    the gbind.
    While debugging this, I found also a bug in the
gimple_seq_last_nondebug_stmt
    function, for a seq that has a single non-DEBUG_BEGIN_STMT statement
    followed by one or more DEBUG_BEGIN_STMTs it would return NULL rather than
    the first statement.

    2020-03-26  Jakub Jelinek  <jakub@redhat.com>

            PR debug/94281
            * gimple.h (gimple_seq_first_nondebug_stmt): New function.
            (gimple_seq_last_nondebug_stmt): Don't return NULL if seq contains
            a single non-debug stmt followed by one or more debug stmts.
            * gimplify.c (gimplify_body): Use gimple_seq_first_nondebug_stmt
            instead of gimple_seq_first_stmt, use
gimple_seq_first_nondebug_stmt
            and gimple_seq_last_nondebug_stmt instead of gimple_seq_first and
            gimple_seq_last to check if outer_stmt gbind could be reused and
            if yes and it is surrounded by any debug stmts, move them into the
            gbind body.

            * g++.dg/debug/pr94281.C: New test.

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

* [Bug debug/94281] [8/9 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-03-26  9:11 ` cvs-commit at gcc dot gnu.org
@ 2020-03-30 15:07 ` jakub at gcc dot gnu.org
  2021-05-14  9:53 ` [Bug debug/94281] [9 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-30 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10 Regression] g++:    |[8/9 Regression] g++:
                   |error: hash.cpp:            |error: hash.cpp:
                   |‘-fcompare-debug’ failure   |‘-fcompare-debug’ failure
                   |(length) since              |(length) since
                   |r8-5241-g8697bf9f46f36168   |r8-5241-g8697bf9f46f36168

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

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

* [Bug debug/94281] [9 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-03-30 15:07 ` [Bug debug/94281] [8/9 " jakub at gcc dot gnu.org
@ 2021-05-14  9:53 ` jakub at gcc dot gnu.org
  2021-06-01  8:17 ` rguenth at gcc dot gnu.org
  2022-05-27  8:49 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug debug/94281] [9 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-05-14  9:53 ` [Bug debug/94281] [9 " jakub at gcc dot gnu.org
@ 2021-06-01  8:17 ` rguenth at gcc dot gnu.org
  2022-05-27  8:49 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug debug/94281] [9 Regression] g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168
  2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-06-01  8:17 ` rguenth at gcc dot gnu.org
@ 2022-05-27  8:49 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|9.5                         |10.0

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 10.

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

end of thread, other threads:[~2022-05-27  8:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 14:04 [Bug debug/94281] New: g++: error: hash.cpp: ‘-fcompare-debug’ failure (length) since r8-5241-g8697bf9f46f36168 marxin at gcc dot gnu.org
2020-03-23 14:04 ` [Bug debug/94281] [8/9/10 Regression] " marxin at gcc dot gnu.org
2020-03-23 15:23 ` rguenth at gcc dot gnu.org
2020-03-24  9:02 ` marxin at gcc dot gnu.org
2020-03-24 10:17 ` marxin at gcc dot gnu.org
2020-03-25 13:52 ` jakub at gcc dot gnu.org
2020-03-25 14:40 ` jakub at gcc dot gnu.org
2020-03-26  9:11 ` cvs-commit at gcc dot gnu.org
2020-03-30 15:07 ` [Bug debug/94281] [8/9 " jakub at gcc dot gnu.org
2021-05-14  9:53 ` [Bug debug/94281] [9 " jakub at gcc dot gnu.org
2021-06-01  8:17 ` rguenth at gcc dot gnu.org
2022-05-27  8:49 ` 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).