In this particular case the compiler is both right and wrong. It is right to 
complain, because as Paul pointed out, there is a free on a non-malloced object 
(ompi_mpi_comm_null). However, this free is protected by the reference count 
going to zero, and this should never happens in this particular piece of code 
(hopefully!).

What we really need here is one of the following:
1) to simply decrease the reference count once, to signal that ompi_comm_parent 
is not using the ompi_mpi_comm_null anymore. Unfortunately, we don't have such 
a macro.

2) As, in this code, we handle only statically allocated objects remove the 
OBJ_RELEASE from the dyn_init code, and their counterpart (OBJ_RETAIN) in the 
comm_init.c:166.

  george.

On Aug 25, 2010, at 12:05 , Paul H. Hargrove wrote:

> Ralph,
> 
> This is seen when compiling Open MPI.  I suspect that gcc's analysis is 
> seeing a free() call on a value it can prove did not come from malloc() (or 
> equivalent).  However, if as you say the value is always NULL, then this 
> would be a false alarm.
> 
> -Paul
> 
> Ralph Castain wrote:
>> Hi Paul
>> 
>> Much appreciate all your testing!
>> 
>> Quick question here: is this on compile, or were you trying to run something?
>> 
>> We haven't seen this before, but I'm wondering if it is due to us failing to 
>> initialize an object's fields. If so, then it might be we don't see it 
>> because those fields usually default to zero (looks like NULL), but you 
>> might see it if they don't on your system.
>> 
>> Ralph
>> 
>> On Aug 24, 2010, at 10:19 PM, Paul H. Hargrove wrote:
>> 
>>  
>>> With both recent RCs I get the following suspicious warnings from gcc-4.5.0 
>>> on Linux/ia64
>>> 
>>> 1.4.3rc1:
>>> 
>>> ../../../../../ompi/mca/dpm/orte/dpm_orte.c:963:5: warning: attempt to free 
>>> a non-heap object 'ompi_mpi_comm_null'
>>> ../../../../../ompi/mca/dpm/orte/dpm_orte.c:965:5: warning: attempt to free 
>>> a non-heap object 'ompi_mpi_group_null'
>>> ../../../../../ompi/mca/dpm/orte/dpm_orte.c:967:5: warning: attempt to free 
>>> a non-heap object 'ompi_mpi_errors_are_fatal'
>>> 
>>> 
>>> 1.5rc5:
>>> 
>>> ../../../../../ompi/mca/dpm/orte/dpm_orte.c:990:5: warning: attempt to free 
>>> a non-heap object 'ompi_mpi_comm_null'
>>> ../../../../../ompi/mca/dpm/orte/dpm_orte.c:992:5: warning: attempt to free 
>>> a non-heap object 'ompi_mpi_group_null'
>>> ../../../../../ompi/mca/dpm/orte/dpm_orte.c:994:5: warning: attempt to free 
>>> a non-heap object 'ompi_mpi_errors_are_fatal'
>>> 
>>> -Paul
>>> 
>>> -- 
>>> Paul H. Hargrove                          phhargr...@lbl.gov
>>> Future Technologies Group
>>> HPC Research Department                   Tel: +1-510-495-2352
>>> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>>> 
>>> _______________________________________________
>>> devel mailing list
>>> de...@open-mpi.org
>>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>>    
>> 
>> 
>> _______________________________________________
>> devel mailing list
>> de...@open-mpi.org
>> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>  
> 
> -- 
> Paul H. Hargrove                          phhargr...@lbl.gov
> Future Technologies Group
> HPC Research Department                   Tel: +1-510-495-2352
> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
> 
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/devel


Reply via email to