public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error
@ 2023-07-17 10:14 geoffreydgr at icloud dot com
  2023-07-19 13:01 ` [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values dmalcolm at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: geoffreydgr at icloud dot com @ 2023-07-17 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110700
           Summary: gcc -fanalyzer --analyzer-checker=taint encouters an
                    error
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: geoffreydgr at icloud dot com
  Target Milestone: ---

when i try to use taint checher to handle the following case, i encouter an
error.


```c
 __attribute__ ((tainted_args))
double divide(double x, double y){
return x/y;
}
```
cmd:
gcc -fanalyzer --analyzer-checker=taint cwe-369.c -c

error messages:
"
// Target: x86_64-pc-linux-gnu
// Configured with: ../gcc/configure -prefix=/usr/local/gcc-13-9533
--enable-checking=release --enable-languages=c,c++ --disable-multilib
// Thread model: posix
// Supported LTO compression algorithms: zlib
// gcc version 13.1.1 20230717 (GCC)
//
// during IPA pass: analyzer
// CWE/cwe-369.c: In function 'divide':
// CWE/cwe-369.c:3:9: internal compiler error: in wide_int_to_tree_1, at
tree.cc:1755
//     3 | return x/y;
//       |        ~^~
// 0x712cea wide_int_to_tree_1
//      ../../gcc/gcc/tree.cc:1755
// 0xf4187b wide_int_to_tree(tree_node*, poly_int<1u,
generic_wide_int<wide_int_ref_storage<false, true> > > const&)
//      ../../gcc/gcc/tree.cc:1867
// 0xf4187b build_int_cst(tree_node*, poly_int<1u, long>)
//      ../../gcc/gcc/tree.cc:1507
// 0x1007587 ana::region_model_manager::get_or_create_int_cst(tree_node*,
poly_int<1u, long>)
//      ../../gcc/gcc/analyzer/region-model-manager.cc:236
// 0x1028059 check_for_tainted_divisor
//      ../../gcc/gcc/analyzer/sm-taint.cc:1355
// 0x1028059 on_stmt
//      ../../gcc/gcc/analyzer/sm-taint.cc:1015
// 0xfd5dbf ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*,
ana::path_context*)
//      ../../gcc/gcc/analyzer/engine.cc:1490
// 0xfd86bd ana::exploded_graph::process_node(ana::exploded_node*)
//      ../../gcc/gcc/analyzer/engine.cc:4063
// 0xfd94fa ana::exploded_graph::process_worklist()
//      ../../gcc/gcc/analyzer/engine.cc:3466
// 0xfdb7e7 ana::impl_run_checkers(ana::logger*)
//      ../../gcc/gcc/analyzer/engine.cc:6125
// 0xfdc7c6 ana::run_checkers()
//      ../../gcc/gcc/analyzer/engine.cc:6213
// 0xfccf68 execute
//      ../../gcc/gcc/analyzer/analyzer-pass.cc:87
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://gcc.gnu.org/bugs/> for instructions.

// /usr/local/gcc-13-9533/libexec/gcc/x86_64-pc-linux-gnu/13.1.1/cc1 -quiet
-imultiarch x86_64-linux-gnu CWE/cwe-369.c -quiet -dumpbase cwe-369.c
-dumpbase-ext .c -mtune=generic -march=x86-64 -fanalyzer
-fanalyzer-checker=taint -freport-bug -o - -frandom-seed=0 -fdump-noaddr

"

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

* [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values
  2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
@ 2023-07-19 13:01 ` dmalcolm at gcc dot gnu.org
  2023-07-19 21:56 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-07-19 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gcc -fanalyzer              |ICE with -fanalyzer
                   |--analyzer-checker=taint    |--analyzer-checker=taint on
                   |encouters an error          |division of tainted
                   |                            |floating-point values
   Last reconfirmed|                            |2023-07-19
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this bug.

Seems to affect GCC 12, 13, and trunk.

Here's the reproducer on Compiler Explorer:
  https://godbolt.org/z/GWM1G6b3s

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

* [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values
  2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
  2023-07-19 13:01 ` [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values dmalcolm at gcc dot gnu.org
@ 2023-07-19 21:56 ` cvs-commit at gcc dot gnu.org
  2023-07-19 22:10 ` dmalcolm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-19 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:b86c0fe327a5196a316bd698d12765b08de5dce7

commit r14-2658-gb86c0fe327a5196a316bd698d12765b08de5dce7
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed Jul 19 17:55:09 2023 -0400

    analyzer: fix ICE on division of tainted floating-point values [PR110700]

    gcc/analyzer/ChangeLog:
            PR analyzer/110700
            * region-model-manager.cc
            (region_model_manager::get_or_create_int_cst): Assert that we have
            an integral or pointer type.
            * sm-taint.cc (taint_state_machine::check_for_tainted_divisor):
            Don't check non-integral types.

    gcc/testsuite/ChangeLog:
            PR analyzer/110700
            * gcc.dg/analyzer/taint-divisor-2.c: New test.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

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

* [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values
  2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
  2023-07-19 13:01 ` [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values dmalcolm at gcc dot gnu.org
  2023-07-19 21:56 ` cvs-commit at gcc dot gnu.org
@ 2023-07-19 22:10 ` dmalcolm at gcc dot gnu.org
  2023-10-17 10:28 ` [Bug analyzer/110700] [12/13 Regression] " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-07-19 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed on trunk by the above patch.  Keeping open to track backporting
to branches for gcc 12 and gcc 13.

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

* [Bug analyzer/110700] [12/13 Regression] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values
  2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
                   ` (2 preceding siblings ...)
  2023-07-19 22:10 ` dmalcolm at gcc dot gnu.org
@ 2023-10-17 10:28 ` rguenth at gcc dot gnu.org
  2024-05-09 17:11 ` cvs-commit at gcc dot gnu.org
  2024-05-09 17:53 ` [Bug analyzer/110700] [12 " dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-10-17 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.4

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

* [Bug analyzer/110700] [12/13 Regression] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values
  2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
                   ` (3 preceding siblings ...)
  2023-10-17 10:28 ` [Bug analyzer/110700] [12/13 Regression] " rguenth at gcc dot gnu.org
@ 2024-05-09 17:11 ` cvs-commit at gcc dot gnu.org
  2024-05-09 17:53 ` [Bug analyzer/110700] [12 " dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-09 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by David Malcolm
<dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:0df1ee083434ac00ecb19582b1e5b25e105981b2

commit r13-8746-g0df1ee083434ac00ecb19582b1e5b25e105981b2
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu May 9 13:09:28 2024 -0400

    analyzer: fix ICE on division of tainted floating-point values [PR110700]

    gcc/analyzer/ChangeLog:
            PR analyzer/110700
            * region-model-manager.cc
            (region_model_manager::get_or_create_int_cst): Assert that we have
            an integral or pointer type.
            * sm-taint.cc (taint_state_machine::check_for_tainted_divisor):
            Don't check non-integral types.

    gcc/testsuite/ChangeLog:
            PR analyzer/110700
            * gcc.dg/analyzer/taint-divisor-2.c: New test.

    (cherry picked from commit r14-2658-gb86c0fe327a519)

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

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

* [Bug analyzer/110700] [12 Regression] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values
  2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
                   ` (4 preceding siblings ...)
  2024-05-09 17:11 ` cvs-commit at gcc dot gnu.org
@ 2024-05-09 17:53 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-05-09 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] ICE with |[12 Regression] ICE with
                   |-fanalyzer                  |-fanalyzer
                   |--analyzer-checker=taint on |--analyzer-checker=taint on
                   |division of tainted         |division of tainted
                   |floating-point values       |floating-point values

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed for GCC 13 (for the upcoming GCC 13.3) by the above patch.

Keeping open to track backporting to older branches.

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

end of thread, other threads:[~2024-05-09 17:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 10:14 [Bug analyzer/110700] New: gcc -fanalyzer --analyzer-checker=taint encouters an error geoffreydgr at icloud dot com
2023-07-19 13:01 ` [Bug analyzer/110700] ICE with -fanalyzer --analyzer-checker=taint on division of tainted floating-point values dmalcolm at gcc dot gnu.org
2023-07-19 21:56 ` cvs-commit at gcc dot gnu.org
2023-07-19 22:10 ` dmalcolm at gcc dot gnu.org
2023-10-17 10:28 ` [Bug analyzer/110700] [12/13 Regression] " rguenth at gcc dot gnu.org
2024-05-09 17:11 ` cvs-commit at gcc dot gnu.org
2024-05-09 17:53 ` [Bug analyzer/110700] [12 " dmalcolm 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).