Created attachment 25257 [details] just compile it MALLOC_CHECK_ glibc detects free() invalid pointer in compiler
Works for me with 4.7 (also in valgrind); with 4.6.1 20110801 [gcc-4_6-branch revision 177033] I get an ICE (abort) and valgrind shows: ==5778== Invalid read of size 4 ==5778== at 0x5FC8C10: __gmpz_clear (in /usr/lib64/libgmp.so.10.0.1) However, using 4.7.0 20110908 (experimental) [trunk revision 178693] I do not get an ICE/valgrind warning - hence it might be fixed.
PR 50050 ?
(In reply to comment #2) > PR 50050 ? Yes, your patch(es) for PR 50050 appear to have fixed this issue. I had an older 4.5.4 that gave an error, but a newly built 4.5.4 works as expected. Vittorio, can you update your 4.6.1 to a newer version and retry your test case?
I thought I had the latest version of gfortran... Where can I find the latest one, with sources?
On Tue, Sep 13, 2011 at 08:08:33PM +0000, zeccav at gmail dot com wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50378 > > --- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> 2011-09-13 20:08:33 UTC --- > I thought I had the latest version of gfortran... > Where can I find the latest one, with sources? > What does gfortran -v report? Your code causes not problem for gcc version 4.5.4 20110913 (prerelease) (GCC) gcc version 4.6.1 20110606 (prerelease) (GCC) gcc version 4.7.0 20110908 (experimental) (GCC) In looking at the date of my 4.6.1, I may have messed up my testing becaue Mikael patch is after that date. Time to rebuild and retest.
I have gfortran 4.6.1 I am downloading gcc-4.7.tar.xz from gfortran.org right now. Tomorrow I'll check it, it is night here.
(In reply to comment #4) > I thought I had the latest version of gfortran... > Where can I find the latest one, with sources? While 4.6.1 (released 2011-08-17) is the latest stable release, you should use the latest branch ("gcc-4_6-branch") or the development version (trunk, 4.7). They are available via Subversion (http://gcc.gnu.org/svn.html), GIT (http://gcc.gnu.org/git/?p=gcc.git) and as regular (weekly?) source snapshots. Additionally, there exists also binary builds. See http://gcc.gnu.org/wiki/GFortranBinaries for a link to the binaries and (at the bottom) some pieces of information/links for building GCC from source. It makes sense to report bugs against the current gcc-4_6-branch or 4.7 as those contain all the existing fixes, which will be part in the next release. Also Linux distributions tend to base their GCC packages on the release branches and not on the releases from the release branch.
gfortran 4.7.0 fixes this one. However, sometimes I get the following: /home/vitti/gcc-4.7/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/f951: symbol lookup error: /home/vitti/gcc-4.7/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/f951: undefined symbol: mpfr_get_z_exp Never got this one, I have mpfr-3.0.0-4 How can I fix it?
(In reply to comment #8) > x86_64-unknown-linux-gnu/4.7.0/f951: > symbol lookup error: > undefined symbol: mpfr_get_z_exp > > Never got this one, I have mpfr-3.0.0-4 See http://www.mpfr.org/mpfr-3.0.0/#changes and http://www.mpfr.org/mpfr-3.0.1/mpfr.html#Changed-Functions "mpfr_get_z_exp changed in MPFR 3.0 [...] this function has been renamed to mpfr_get_z_2exp in MPFR 3.0" and "mpfr_get_z_exp is still available via a macro in mpfr.h". Seemingly, you have a f951 which has been compiled with MPFR 2.x but you run it with MPFR 3. In that case, the macro does not help. gfortran calls this function for real-to-integer conversions, which seems to be the only use.
gfortran 4.7.0 has been compiled with the old mpfr 2.4.2, I just downloaded it, this one will probably work. Anyway gfortran 4.7.0 does not give free() errors.
(In reply to comment #10) > gfortran 4.7.0 has been compiled with the old mpfr 2.4.2, I just downloaded it, > this one will probably work. > Anyway gfortran 4.7.0 does not give free() errors. Thanks for the bug report and confirming that the issue is fixed.