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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tim Lange <tla...@gcc.gnu.org>:

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

commit r13-2115-gc83e97317efb87fd5639a9ee9ec55aa1caa5423e
Author: Tim Lange <m...@tim-lange.me>
Date:   Thu Aug 18 11:36:08 2022 +0200

    analyzer: warn on the use of floating-points operands in the size argument
[PR106181]

    This patch fixes the ICE reported in PR106181 and adds a new warning to
    the analyzer complaining about the use of floating-point operands.

    Regrtested on Linux x86_64.

    2022-08-17  Tim Lange  <m...@tim-lange.me>

    gcc/analyzer/ChangeLog:

            PR analyzer/106181
            * analyzer.opt: Add Wanalyzer-imprecise-floating-point-arithmetic.
            * region-model.cc (is_any_cast_p): Formatting.
            (region_model::check_region_size): Ensure precondition.
            (class imprecise_floating_point_arithmetic): New abstract
            diagnostic class for all floating-point related warnings.
            (class float_as_size_arg): Concrete diagnostic class to complain
            about floating-point operands inside the size argument.
            (class contains_floating_point_visitor):
            New visitor to find floating-point operands inside svalues.
            (region_model::check_dynamic_size_for_floats): New function.
            (region_model::set_dynamic_extents):
            Call to check_dynamic_size_for_floats.
            * region-model.h (class region_model):
            Add region_model::check_dynamic_size_for_floats.

    gcc/ChangeLog:

            PR analyzer/106181
            * doc/invoke.texi: Add Wanalyzer-imprecise-fp-arithmetic.

    gcc/testsuite/ChangeLog:

            PR analyzer/106181
            * gcc.dg/analyzer/allocation-size-1.c: New test.
            * gcc.dg/analyzer/imprecise-floating-point-1.c: New test.
            * gcc.dg/analyzer/pr106181.c: New test.

Reply via email to