public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
@ 2022-08-08 6:39 slyfox at gcc dot gnu.org
2022-08-08 6:52 ` [Bug analyzer/106551] " rguenth at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-08-08 6:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
Bug ID: 106551
Summary: [13 Regression] dup2 causes -fanalyser ICE in
valid_to_unchecked_state, at analyzer/sm-fd.cc:751
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
This week's gcc started ICEing on libpipeline-1.5.4 upstream package.
Minimal reproducer turned up by cvise:
$ cat a.c.c
extern int m;
int dup2(int, int);
void error(void);
void max_active_pipelines_pdes(void) {
if (dup2(m, 1))
error();
}
$ gcc -g -O2 -Wall -c a.c.c -fanalyzer
during IPA pass: analyzer
a.c.c: In function 'max_active_pipelines_pdes':
a.c.c:5:7: internal compiler error: in valid_to_unchecked_state, at
analyzer/sm-fd.cc:751
5 | if (dup2(m, 1))
| ^~~~~~~~~~
0x1ef7d74 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
???:0
0x1ef89c6 internal_error(char const*, ...)
???:0
0x9023d4 fancy_abort(char const*, int, char const*)
???:0
0x85baa7 ana::(anonymous
namespace)::fd_state_machine::check_for_dup(ana::sm_context*, ana::supernode
const*, gimple const*, gcall const*, tree_node*, ana::(anonymous
namespace)::dup) const [clone .cold]
???:0
0x135181c ana::(anonymous
namespace)::fd_state_machine::on_stmt(ana::sm_context*, ana::supernode const*,
gimple const*) const
???:0
0x12fcd74 ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*,
ana::path_context*)
???:0
0x12ff7ab ana::exploded_graph::process_node(ana::exploded_node*)
???:0
0x130064a ana::exploded_graph::process_worklist()
???:0
0x1302999 ana::impl_run_checkers(ana::logger*)
???:0
0x130394e ana::run_checkers()
???:0
0x12f37e8 (anonymous namespace)::pass_analyzer::execute(function*)
???:0
$ gcc -v |& unnix
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-13.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220807 (experimental) (GCC)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
@ 2022-08-08 6:52 ` rguenth at gcc dot gnu.org
2022-08-08 14:02 ` dmalcolm at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-08 6:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
2022-08-08 6:52 ` [Bug analyzer/106551] " rguenth at gcc dot gnu.org
@ 2022-08-08 14:02 ` dmalcolm at gcc dot gnu.org
2022-08-09 7:48 ` [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer " mir at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-08-08 14:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mir at gcc dot gnu.org
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this; almost certainly related to
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6a11f2d974a912aaaedb0ce32cdfde10193003cd
Immad, do you want to take a look?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
2022-08-08 6:52 ` [Bug analyzer/106551] " rguenth at gcc dot gnu.org
2022-08-08 14:02 ` dmalcolm at gcc dot gnu.org
@ 2022-08-09 7:48 ` mir at gcc dot gnu.org
2022-08-11 16:21 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mir at gcc dot gnu.org @ 2022-08-09 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
--- Comment #2 from Immad Mir <mir at gcc dot gnu.org> ---
Sergei Trofimovich: Thanks for bringing the issue to our attention.
Dave: I've sent a patch via gcc-patches.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2022-08-09 7:48 ` [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer " mir at gcc dot gnu.org
@ 2022-08-11 16:21 ` cvs-commit at gcc dot gnu.org
2022-08-14 20:27 ` tlange at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-11 16:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Immad Mir <mir@gcc.gnu.org>:
https://gcc.gnu.org/g:837142257cbde3cc03ee0dacd1d7b2fb4fa48bae
commit r13-2023-g837142257cbde3cc03ee0dacd1d7b2fb4fa48bae
Author: Immad Mir <mirimmad@outlook.com>
Date: Thu Aug 11 21:45:54 2022 +0530
analyzer: fix ICE casued by dup2 in sm-fd.cc[PR106551]
This patch fixes the ICE caused by valid_to_unchecked_state,
at analyzer/sm-fd.cc by handling the m_start state in
check_for_dup.
Tested lightly on x86_64.
gcc/analyzer/ChangeLog:
PR analyzer/106551
* sm-fd.cc (check_for_dup): handle the m_start
state when transitioning the state of LHS
of dup, dup2 and dup3 call.
gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/fd-dup-1.c: New testcases.
* gcc.dg/analyzer/fd-uninit-1.c: Remove bogus
warning.
Signed-off-by: Immad Mir <mirimmad@outlook.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2022-08-11 16:21 ` cvs-commit at gcc dot gnu.org
@ 2022-08-14 20:27 ` tlange at gcc dot gnu.org
2022-08-15 8:37 ` mir at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tlange at gcc dot gnu.org @ 2022-08-14 20:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
Tim Lange <tlange at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tlange at gcc dot gnu.org
--- Comment #4 from Tim Lange <tlange at gcc dot gnu.org> ---
Hi Immad,
while testing my patch on coreutils [1], I encountered another ICE at the same
line. I'm using the newest commit on the master at the time of writing this [2]
(I've double-checked that I indeed have your fix included).
during IPA pass: analyzer
../lib/freopen.c: In function 'rpl_freopen':
../lib/freopen.c:82:19: internal compiler error: in valid_to_unchecked_state,
at analyzer/sm-fd.cc:751
82 | if (dup2 (nullfd, fd) < 0)
| ^~~~~~~~~~~~~~~~~
0x7bc106 valid_to_unchecked_state
../../gcc/analyzer/sm-fd.cc:751
0x7bc106 valid_to_unchecked_state
../../gcc/analyzer/sm-fd.cc:742
0x7bc106 check_for_dup
../../gcc/analyzer/sm-fd.cc:990
0x12a5e8c on_stmt
../../gcc/analyzer/sm-fd.cc:805
0x124f4e4 ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*,
ana::path_context*)
../../gcc/analyzer/engine.cc:1449
0x1251f1b ana::exploded_graph::process_node(ana::exploded_node*)
../../gcc/analyzer/engine.cc:3868
0x1252dba ana::exploded_graph::process_worklist()
../../gcc/analyzer/engine.cc:3271
0x125514d ana::impl_run_checkers(ana::logger*)
../../gcc/analyzer/engine.cc:5912
0x125614e ana::run_checkers()
../../gcc/analyzer/engine.cc:5986
0x1245ee8 execute
../../gcc/analyzer/analyzer-pass.cc:87
[1] compiling coreutils commit:
https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=9f71f478ec6929d323c17f0482db8791de87b4fd
[2]
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=fe4dc4f553d8639b0ce3465e5e6dcf61c1ae9752
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
` (4 preceding siblings ...)
2022-08-14 20:27 ` tlange at gcc dot gnu.org
@ 2022-08-15 8:37 ` mir at gcc dot gnu.org
2022-08-15 16:52 ` cvs-commit at gcc dot gnu.org
2022-08-15 16:55 ` mir at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mir at gcc dot gnu.org @ 2022-08-15 8:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
--- Comment #5 from Immad Mir <mir at gcc dot gnu.org> ---
Thanks for reporting the ICE, Tim.
Dave: I have sent a patch via gcc-patches.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
` (5 preceding siblings ...)
2022-08-15 8:37 ` mir at gcc dot gnu.org
@ 2022-08-15 16:52 ` cvs-commit at gcc dot gnu.org
2022-08-15 16:55 ` mir at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-15 16:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Immad Mir <mir@gcc.gnu.org>:
https://gcc.gnu.org/g:ed7e7620188dc0e653815bdd40d8802bd5446638
commit r13-2051-ged7e7620188dc0e653815bdd40d8802bd5446638
Author: Immad Mir <mirimmad@outlook.com>
Date: Mon Aug 15 22:21:27 2022 +0530
analyzer: fix for ICE in sm-fd.cc [PR106551]
This patch fixes the ICE caused by valid_to_unchecked_state
in sm-fd.cc by exiting early if first argument of any "dup"
functions is invalid.
gcc/analyzer/ChangeLog:
PR analyzer/106551
* sm-fd.cc (check_for_dup): exit early if first
argument is invalid for all dup functions.
gcc/testsuite/ChangeLog:
PR analyzer/106551
* gcc.dg/analyzer/fd-dup-1.c: New testcase.
Signed-off-by: Immad Mir <mirimmad@outlook.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
` (6 preceding siblings ...)
2022-08-15 16:52 ` cvs-commit at gcc dot gnu.org
@ 2022-08-15 16:55 ` mir at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mir at gcc dot gnu.org @ 2022-08-15 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106551
--- Comment #7 from Immad Mir <mir at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #6)
The patch was lightly tested on x86_64 Linux.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-08-15 16:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 6:39 [Bug analyzer/106551] New: [13 Regression] dup2 causes -fanalyser ICE in valid_to_unchecked_state, at analyzer/sm-fd.cc:751 slyfox at gcc dot gnu.org
2022-08-08 6:52 ` [Bug analyzer/106551] " rguenth at gcc dot gnu.org
2022-08-08 14:02 ` dmalcolm at gcc dot gnu.org
2022-08-09 7:48 ` [Bug analyzer/106551] [13 Regression] dup2 causes -fanalyzer " mir at gcc dot gnu.org
2022-08-11 16:21 ` cvs-commit at gcc dot gnu.org
2022-08-14 20:27 ` tlange at gcc dot gnu.org
2022-08-15 8:37 ` mir at gcc dot gnu.org
2022-08-15 16:52 ` cvs-commit at gcc dot gnu.org
2022-08-15 16:55 ` mir 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).