This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- From: Duncan Sands <duncan dot sands at math dot u-psud dot fr>
- To: gcc at gcc dot gnu dot org
- Cc: "Richard Guenther" <richard dot guenther at gmail dot com>, "Gabriel Dos Reis" <gdr at integrable-solutions dot net>, "Richard Kenner" <kenner at vlsi1 dot ultra dot nyu dot edu>, ebb9 at byu dot net, autoconf-patches at gnu dot org, bernds_cb1 at t-online dot de, bug-gnulib at gnu dot org, eggert at cs dot ucla dot edu, pinskia at physics dot uc dot edu, "Zdenek Dvorak" <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Date: Sun, 31 Dec 2006 12:17:20 +0100
- Subject: Re: changing "configure" to default to "gcc -g -O2 -fwrapv ..."
- References: <200612300047.kBU0lFwk014817@localhost.localdomain> <m3vejtx894.fsf@zeus.integrable-solutions.net> <84fc9c000612310257k59dd509et4ebcb05b7cbae7f6@mail.gmail.com>
> > for this specific function (vrp_int_const_binop), I'm issuing a
> > warning inside the else-if branch that tests for the overflowed
> > result. I'm unclear why that is a false positive since the result is
> > known to overflow. Could you elaborate?
>
> Well, we use that function to do arithmetic on value ranges like
> for example the ranges involving the expression a + b
>
> [50, INT_MAX] + [50, 100]
>
> now you will get a warning as we use vrp_int_const_binop to add
> INT_MAX and 100 (to yield INT_MAX in the signed case). Of
> course adding a + b will not always overflow here (it might never
> as the INT_MAX bound might be just due to VRP deficiencies),
> for example 50 + 50 will not overflow.
>
> So using vrp_int_const_binop to generate the warning will yield
> very many false positives (also due to the fact that if we only know
> the lower or upper bound we have lots of INT_MAX and INT_MIN
> in value ranges).
You could emit a warning if the entire range overflows (i.e. both lower
and upper bound calculations overflow), since that means that the calculation
of a+b necessarily overflows.
Best wishes,
Duncan.