[Bug fortran/42958] Weird temporary array allocation
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sat Mar 27 19:12:00 GMT 2010
------- Comment #11 from rguenth at gcc dot gnu dot org 2010-03-27 19:12 -------
The middle-end ends up with the following optimized:
D.1776_95 = D.1775_94 - D.1591_90;
if (D.1776_95 <= 0)
goto <bb 34>;
else
goto <bb 33>;
<bb 33>:
D.1620_204 = __builtin_malloc (D.1795_11);
D.1796_281 = iy.dim[1].stride;
...
goto <bb 35>;
<bb 34>:
D.1620_135 = __builtin_malloc (1);
goto <bb 38>;
<bb 35>:
the loop code
<bb 38>:
Invalid sum of incoming frequencies 1062, should be 900
# D.1620_374 = PHI <D.1620_204(37), D.1620_135(34)>
if (D.1620_374 != 0B)
goto <bb 39>;
else
goto <bb 40>;
<bb 39>:
__builtin_free (D.1620_374);
so we are able to prove that if we end up allocating 1 byte only then
the loop isn't executed and we just free it (another missed middle-end
optimization, p = malloc(1); free (p); isn't optimized away).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42958
More information about the Gcc-bugs
mailing list