[Bug tree-optimization/79191] potentially truncating unsigned conversion defeats range propagation
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 29 01:10:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79191
--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #2)
> When I add an explicit "-m64" to the compile command I get the same results
> as you, though. Also, it'd be nice if there were a warning from -Wconversion
> for the assignment from m to n in h. Or a warning from -Wimplicit-int for
> uses of bare "unsigned" without the "int" in general (I've actually been
> meaning to file a separate bug for that, but haven't gotten around to it
> yet).
>
Actually looking back on the output there is actually a warning from
-Wconversion when I use -m64 so never mind about that part:
$ /usr/local/bin/gcc -c -O2 -S -Wall -fdump-tree-optimized=/dev/stdout -Wextra
-pedantic -Wconversion -m64 79191.c
79191.c: In function ‘h’:
79191.c:15:15: warning: conversion from ‘long unsigned int’ to ‘unsigned int’
may change value [-Wconversion]
unsigned n = m;
^
;; Function f (f, funcdef_no=0, decl_uid=1832, cgraph_uid=0, symbol_order=0)
f (long unsigned int n)
{
<bb 2> [100.00%] [count: INV]:
if (n_1(D) > 3)
goto <bb 3>; [0.04%] [count: 0]
else
goto <bb 4>; [99.96%] [count: INV]
<bb 3> [0.04%] [count: 0]:
__builtin_abort ();
<bb 4> [99.96%] [count: INV]:
return;
}
;; Function g (g, funcdef_no=1, decl_uid=1835, cgraph_uid=1, symbol_order=1)
g (unsigned int n)
{
<bb 2> [100.00%] [count: INV]:
return;
}
;; Function h (h, funcdef_no=2, decl_uid=1838, cgraph_uid=2, symbol_order=2)
Removing basic block 6
Removing basic block 7
h (long unsigned int m)
{
unsigned int n;
long unsigned int _5;
<bb 2> [100.00%] [count: INV]:
n_2 = (unsigned int) m_1(D);
if (n_2 <= 2)
goto <bb 3>; [50.00%] [count: INV]
else
goto <bb 5>; [50.00%] [count: INV]
<bb 3> [50.00%] [count: INV]:
_5 = m_1(D) & 4294967292;
if (_5 != 0)
goto <bb 4>; [0.04%] [count: 0]
else
goto <bb 5>; [99.96%] [count: INV]
<bb 4> [0.02%] [count: 0]:
__builtin_abort ();
<bb 5> [99.98%] [count: INV]:
return;
}
$
More information about the Gcc-bugs
mailing list