StanfordLegion / legion

The Legion Parallel Programming System
https://legion.stanford.edu
Apache License 2.0
675 stars 145 forks source link

Legion: warning `‘it.Legion::Domain::DomainPointIterator::is_valid’ may be used uninitialized` #1714

Closed mariodirenzo closed 2 months ago

mariodirenzo commented 2 months ago

Newer versions of the runtime return with multiple compilers the following warning

In member function ‘Legion::Domain::DomainPointIterator::operator bool() const’,
    inlined from ‘virtual void HTR::Prometeo::PrometeoMapper::Mapper::slice_task(Legion::Mapping::MapperContext, const HTR::Task&, const Legion::Mapping::Mapper::SliceTaskInput&, Legion::Mapping::Mapper::SliceTaskOutput&)’ at /g/g92/direnzo1/htr_tioga/src/prometeo/mapper.cc:616:55:
/g/g92/direnzo1/legion_tioga/runtime/legion/legion_domain.inl:1288:12: warning: ‘it.Legion::Domain::DomainPointIterator::is_valid’ may be used uninitialized [-Wmaybe-uninitialized]
 1288 |     return is_valid && rect_valid;
      |            ^~~~~~~~
/g/g92/direnzo1/htr_tioga/src/prometeo/mapper.cc: In member function ‘virtual void HTR::Prometeo::PrometeoMapper::Mapper::slice_task(Legion::Mapping::MapperContext, const HTR::Task&, const Legion::Mapping::Mapper::SliceTaskInput&, Legion::Mapping::Mapper::SliceTaskOutput&)’:
/g/g92/direnzo1/htr_tioga/src/prometeo/mapper.cc:616:37: note: ‘it’ declared here
  616 |    for (Domain::DomainPointIterator it(input.domain); it; it++) {
      |                                     ^~

I think that it is due to a missing default initialization of is_valid in the function https://gitlab.com/StanfordLegion/legion/-/blob/master/runtime/legion/legion_domain.inl?ref_type=heads#L1197

@elliottslaughter, can you add this issue to #1032 ?

elliottslaughter commented 2 months ago

You mentioned "multiple compilers", but what compilers are these exactly?

mariodirenzo commented 2 months ago

gcc/11.3.0, gcc/12.2.0, and clang/16.0.6

lightsighter commented 2 months ago

Try with: https://gitlab.com/StanfordLegion/legion/-/merge_requests/1371

mariodirenzo commented 2 months ago

That fixes the issue

lightsighter commented 2 months ago

Merged