public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions
@ 2020-03-23 11:06 zsojka at seznam dot cz
2020-03-23 11:23 ` [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241 jakub at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2020-03-23 11:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
Bug ID: 94272
Summary: [8/9/10 Regression] -fcompare-debug failure (length)
with -O -fnon-call-exceptions
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
CC: aoliva at gcc dot gnu.org
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Created attachment 48084
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48084&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-g++ -O -fnon-call-exceptions -fcompare-debug testcase.C
x86_64-pc-linux-gnu-g++: error: testcase.C: '-fcompare-debug' failure (length)
$ x86_64-pc-linux-gnu-g++ -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g++
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r10-7327-20200323085706-g2fa4b1ffd6e-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r10-7327-20200323085706-g2fa4b1ffd6e-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.1 20200323 (experimental) (GCC)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
@ 2020-03-23 11:23 ` jakub at gcc dot gnu.org
2020-03-23 12:39 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-23 11:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
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|UNCONFIRMED |ASSIGNED
Summary|[8/9/10 Regression] |[8/9/10 Regression]
|-fcompare-debug failure |-fcompare-debug failure
|(length) with -O |(length) with -O
|-fnon-call-exceptions |-fnon-call-exceptions since
| |r8-5241
Ever confirmed|0 |1
CC| |jakub at gcc dot gnu.org
Last reconfirmed| |2020-03-23
Target Milestone|--- |8.5
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r8-5241-g8697bf9f46f36168ddba5752db582e673e3cbe8c. I'll have a
look.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
2020-03-23 11:23 ` [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241 jakub at gcc dot gnu.org
@ 2020-03-23 12:39 ` jakub at gcc dot gnu.org
2020-03-23 14:06 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-23 12:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Assignee|jakub at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'm afraid this is similar to the PR93786 and I don't have a good solution.
This goes wrong during gimplification, we have:
if (c != 0B && d != 0)
{
(void) 0;
}
else
{
# DEBUG BEGIN STMT;
if (*e != 0) (void) 0;
}
When we call shortcut_cond_expr, the important difference is that without -g,
TREE_SIDE_EFFECTS on else_ (which is in that case a COND_EXPR) is false, but
with -g it is true (else_ is a STATEMENT_LIST with TREE_SIDE_EFFECTS set
containing the DEBUG_BEGIN_STMT with TREE_SIDE_EFFECTS false and the COND_EXPR
also with TREE_SIDE_EFFECTS clear.
Alex?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
2020-03-23 11:23 ` [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241 jakub at gcc dot gnu.org
2020-03-23 12:39 ` jakub at gcc dot gnu.org
@ 2020-03-23 14:06 ` jakub at gcc dot gnu.org
2020-03-23 14:08 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-23 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think another reason why this FAILs is that the IF_STMTs that the FE emits
initially have TREE_SIDE_EFFECTS set, because those are tcc_statement and for
those make_node sets TREE_SIDE_EFFECTS. While genericize_if_stmt genericizes
that into a COND_EXPR, which is tcc_expression and thus has TREE_SIDE_EFFECTS
computed from TREE_SIDE_EFFECTS of the 3 operands (none of them have that set).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (2 preceding siblings ...)
2020-03-23 14:06 ` jakub at gcc dot gnu.org
@ 2020-03-23 14:08 ` jakub at gcc dot gnu.org
2020-03-23 14:09 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-23 14:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48090
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48090&action=edit
gcc10-pr94272.patch
Untested hack (admittedly quite ugly) that seems to fix this testcase.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (3 preceding siblings ...)
2020-03-23 14:08 ` jakub at gcc dot gnu.org
@ 2020-03-23 14:09 ` rguenth at gcc dot gnu.org
2020-03-26 8:19 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-23 14:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (4 preceding siblings ...)
2020-03-23 14:09 ` rguenth at gcc dot gnu.org
@ 2020-03-26 8:19 ` cvs-commit at gcc dot gnu.org
2020-03-26 8:26 ` [Bug debug/94272] [8/9 " jakub at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-26 8:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
--- 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:5a1706f63a2024a5c2d878f2efeb8d198214542f
commit r10-7393-g5a1706f63a2024a5c2d878f2efeb8d198214542f
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 26 09:18:35 2020 +0100
c++: Fix a -fcompare-debug issue with DEBUG_BEGIN_STMT stmts in
STATEMENT_LISTs [PR94272]
The following testcase FAILs with -fcompare-debug. The problem is that
the C++ FE initially uses IF_STMTs, tcc_statement which default to
TREE_SIDE_EFFECTS set, but later on is genericized into COND_EXPRs,
tcc_expression which default to TREE_SIDE_EFFECTS ored from all 3 operands.
Furthermore, with -g we emit by default DEBUG_BEGIN_STMTs
(TREE_SIDE_EFFECTS
clear) and so end up with a STATEMENT_LIST containing DEBUG_BEGIN_STMT
+ e.g. the IF_STMT, while with -g0 we would end up with just the IF_STMT
alone and in that case there is no STATEMENT_LIST wrapping it.
Now, the STATEMENT_LIST has TREE_SIDE_EFFECTS set to match the IF_STMT,
but if none of the 3 operands (condition and both branches) have
TREE_SIDE_EFFECTS, genericize_if_stmt will replace the IF_STMT with
COND_EXPR without TREE_SIDE_EFFECTS, but with -g only STATEMENT_LIST
wrapping it will keep TREE_SIDE_EFFECTS. Then during gimplification,
shortcut_cond_expr checks TREE_SIDE_EFFECTS of the operands and as it
is differennt between -g and -g0, will generate different code.
The following patch attempts to fix this by clearing TREE_SIDE_EFFECTS
on STATEMENT_LISTs that initially have it set and contain only
DEBUG_BEGIN_STMT or at most one other statement that lost TREE_SIDE_EFFECTS
during the genericization.
2020-03-26 Jakub Jelinek <jakub@redhat.com>
PR c++/94272
* cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
* g++.dg/debug/pr94272.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [8/9 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (5 preceding siblings ...)
2020-03-26 8:19 ` cvs-commit at gcc dot gnu.org
@ 2020-03-26 8:26 ` jakub at gcc dot gnu.org
2021-05-14 9:53 ` [Bug debug/94272] [9 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-26 8:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
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
Summary|[8/9/10 Regression] |[8/9 Regression]
|-fcompare-debug failure |-fcompare-debug failure
|(length) with -O |(length) with -O
|-fnon-call-exceptions since |-fnon-call-exceptions since
|r8-5241 |r8-5241
Status|NEW |ASSIGNED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug debug/94272] [9 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (6 preceding siblings ...)
2020-03-26 8:26 ` [Bug debug/94272] [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:48 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ 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=94272
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] 11+ messages in thread
* [Bug debug/94272] [9 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (7 preceding siblings ...)
2021-05-14 9:53 ` [Bug debug/94272] [9 " jakub at gcc dot gnu.org
@ 2021-06-01 8:17 ` rguenth at gcc dot gnu.org
2022-05-27 8:48 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ 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=94272
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] 11+ messages in thread
* [Bug debug/94272] [9 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
` (8 preceding siblings ...)
2021-06-01 8:17 ` rguenth at gcc dot gnu.org
@ 2022-05-27 8:48 ` rguenth at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 8:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94272
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
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] 11+ messages in thread
end of thread, other threads:[~2022-05-27 8:48 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 11:06 [Bug debug/94272] New: [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions zsojka at seznam dot cz
2020-03-23 11:23 ` [Bug debug/94272] [8/9/10 Regression] -fcompare-debug failure (length) with -O -fnon-call-exceptions since r8-5241 jakub at gcc dot gnu.org
2020-03-23 12:39 ` jakub at gcc dot gnu.org
2020-03-23 14:06 ` jakub at gcc dot gnu.org
2020-03-23 14:08 ` jakub at gcc dot gnu.org
2020-03-23 14:09 ` rguenth at gcc dot gnu.org
2020-03-26 8:19 ` cvs-commit at gcc dot gnu.org
2020-03-26 8:26 ` [Bug debug/94272] [8/9 " jakub at gcc dot gnu.org
2021-05-14 9:53 ` [Bug debug/94272] [9 " jakub at gcc dot gnu.org
2021-06-01 8:17 ` rguenth at gcc dot gnu.org
2022-05-27 8:48 ` 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).