* [Bug rtl-optimization/94189] [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
@ 2020-03-16 9:29 ` jakub at gcc dot gnu.org
2020-03-16 9:42 ` [Bug rtl-optimization/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c zhroma 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-16 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On which target? Can't reproduce on x86_64-linux nor powerpc64le-linux.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
2020-03-16 9:29 ` [Bug rtl-optimization/94189] " jakub at gcc dot gnu.org
@ 2020-03-16 9:42 ` zhroma at gcc dot gnu.org
2020-03-16 10:22 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zhroma at gcc dot gnu.org @ 2020-03-16 9:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
Roman Zhuykov <zhroma at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10 Regression] |[9/10 Regression]
|-fcompare-debug failure |-fcompare-debug failure on
|Wstrict-overflow-22.c |Wstringop-overflow-22.c
--- Comment #2 from Roman Zhuykov <zhroma at gcc dot gnu.org> ---
I've screwed up too, sorry :) It should be
gcc/testsuite/gcc.dg/Wstringop-overflow-22.c, file is rather new, available
only in master. Just rechecked it fails on master on powerpc64le and using
9.2-9.3 on x86_64.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
2020-03-16 9:29 ` [Bug rtl-optimization/94189] " jakub at gcc dot gnu.org
2020-03-16 9:42 ` [Bug rtl-optimization/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c zhroma at gcc dot gnu.org
@ 2020-03-16 10:22 ` jakub at gcc dot gnu.org
2020-03-16 10:54 ` [Bug middle-end/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242 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-16 10:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
const char a[] = { 'a', 'b', 'c', 'd' };
int
foo (void)
{
return __builtin_strnlen (a, 5);
}
and this one doesn't generate different code between -O2 -g and -O2, but FAILs
with -fcompare-debug because that one does add -w to the second invocation in
order not to emit all the warnings twice, and apparently the code generation in
this case is dependent on whether the warning is emitted or not.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (2 preceding siblings ...)
2020-03-16 10:22 ` jakub at gcc dot gnu.org
@ 2020-03-16 10:54 ` jakub at gcc dot gnu.org
2020-03-16 10:58 ` jakub 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-16 10:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2020-03-16
Priority|P3 |P2
Ever confirmed|0 |1
Summary|[9/10 Regression] |[9/10 Regression]
|-fcompare-debug failure on |-fcompare-debug failure on
|Wstringop-overflow-22.c |Wstringop-overflow-22.c
| |since r9-3242
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Target Milestone|--- |9.4
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r9-3242-g6c4aa5f6bd8aacf51ddceb78239a7a2da0a1b959.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (3 preceding siblings ...)
2020-03-16 10:54 ` [Bug middle-end/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242 jakub at gcc dot gnu.org
@ 2020-03-16 10:58 ` jakub at gcc dot gnu.org
2020-03-16 10:59 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48038
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48038&action=edit
gcc10-pr94189-1.patch
One possible fix, optimize even if we emit a warning.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (4 preceding siblings ...)
2020-03-16 10:58 ` jakub at gcc dot gnu.org
@ 2020-03-16 10:59 ` jakub at gcc dot gnu.org
2020-03-17 9:43 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-16 10:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48039
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48039&action=edit
gcc10-pr94189-2.patch
Another possible fix. Don't optimize if we would emit a warning and don't emit
it just because the warning isn't enabled, -w or some other warning has been
emitted for the call already. I think this is my preference.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/94189] [9/10 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (5 preceding siblings ...)
2020-03-16 10:59 ` jakub at gcc dot gnu.org
@ 2020-03-17 9:43 ` cvs-commit at gcc dot gnu.org
2020-03-17 9:53 ` [Bug middle-end/94189] [9 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-17 9:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #7 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:7afa3b82918a75a486aad7818f11df9ea7504368
commit r10-7206-g7afa3b82918a75a486aad7818f11df9ea7504368
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Mar 17 10:42:35 2020 +0100
expand: Don't depend on warning flags in code generation of strnlen
[PR94189]
The following testcase FAILs with -O2 -fcompare-debug, but the reason isn't
that we'd emit different code based on -g or non-debug, but rather that
we emit different code depending on whether -w is used or not (or e.g.
-Wno-stringop-overflow or whether some other pass emitted some other
warning
already on the call).
Code generation shouldn't depend on whether we emit a warning or not if at
all possible.
The following patch punts (i.e. doesn't optimize the strnlen call to a
constant value) if we would emit the warning if it was enabled.
In the PR there is an alternate patch which does optimize the strnlen call
no matter if we emit the warning or not, though I think I prefer the
version
below, e.g. the strnlen call might be crossing field boundaries, which is
in
strict reading undefined, but I'd be afraid people do that in the real
world programs.
2020-03-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/94189
* builtins.c (expand_builtin_strnlen): Do return NULL_RTX if we
would
emit a warning if it was enabled and don't depend on
TREE_NO_WARNING
for code-generation.
* gcc.dg/pr94189.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/94189] [9 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (6 preceding siblings ...)
2020-03-17 9:43 ` cvs-commit at gcc dot gnu.org
@ 2020-03-17 9:53 ` jakub at gcc dot gnu.org
2020-03-17 18:57 ` cvs-commit at gcc dot gnu.org
2020-03-17 19:14 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-17 9:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10 Regression] |[9 Regression]
|-fcompare-debug failure on |-fcompare-debug failure on
|Wstringop-overflow-22.c |Wstringop-overflow-22.c
|since r9-3242 |since r9-3242
--- Comment #8 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 middle-end/94189] [9 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (7 preceding siblings ...)
2020-03-17 9:53 ` [Bug middle-end/94189] [9 " jakub at gcc dot gnu.org
@ 2020-03-17 18:57 ` cvs-commit at gcc dot gnu.org
2020-03-17 19:14 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-17 18:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:65de83595faeccd83bc0fefbfb79768f8a3bb2b6
commit r9-8398-g65de83595faeccd83bc0fefbfb79768f8a3bb2b6
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Mar 17 10:42:35 2020 +0100
expand: Don't depend on warning flags in code generation of strnlen
[PR94189]
The following testcase FAILs with -O2 -fcompare-debug, but the reason isn't
that we'd emit different code based on -g or non-debug, but rather that
we emit different code depending on whether -w is used or not (or e.g.
-Wno-stringop-overflow or whether some other pass emitted some other
warning
already on the call).
Code generation shouldn't depend on whether we emit a warning or not if at
all possible.
The following patch punts (i.e. doesn't optimize the strnlen call to a
constant value) if we would emit the warning if it was enabled.
In the PR there is an alternate patch which does optimize the strnlen call
no matter if we emit the warning or not, though I think I prefer the
version
below, e.g. the strnlen call might be crossing field boundaries, which is
in
strict reading undefined, but I'd be afraid people do that in the real
world programs.
2020-03-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/94189
* builtins.c (expand_builtin_strnlen): Do return NULL_RTX if we
would
emit a warning if it was enabled and don't depend on
TREE_NO_WARNING
for code-generation.
* gcc.dg/pr94189.c: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug middle-end/94189] [9 Regression] -fcompare-debug failure on Wstringop-overflow-22.c since r9-3242
2020-03-16 9:05 [Bug rtl-optimization/94189] New: [9/10 Regression] -fcompare-debug failure Wstrict-overflow-22.c zhroma at gcc dot gnu.org
` (8 preceding siblings ...)
2020-03-17 18:57 ` cvs-commit at gcc dot gnu.org
@ 2020-03-17 19:14 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-17 19:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 9.4+ too.
^ permalink raw reply [flat|nested] 11+ messages in thread