Skip to Content.
Sympa Menu

charm - Re: [charm] compiler warning when pupping vector of bool

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] compiler warning when pupping vector of bool


Chronological Thread 
  • From: Robert Steinke <rsteinke AT uwyo.edu>
  • To: Charm Mailing List <charm AT cs.illinois.edu>
  • Subject: Re: [charm] compiler warning when pupping vector of bool
  • Date: Wed, 20 Jul 2016 10:28:54 -0600
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=rsteinke AT uwyo.edu;
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

Thanks for the information.  I didn't know that about vector<bool>.

My next question is will it pup correctly?  If so, I think I will just ignore the warning.  If not, I can pup it manually without using pup_stl.

Or is someone eager to write a pup_stl specialization for vector<bool>?

On 07/20/2016 09:51 AM, Jozsef Bakosi wrote:
Hi Robert,

I'm suspecting that the Charm++-provided PUP routines are for generic containers, i.e., containers that are "real" containers. However, std::vector<bool> is not such a thing. See more at https://isocpp.org/blog/2012/11/on-vectorbool. I suspect the issue could be fixed by providing a specifalization for PUPing a vector of bools.

Jozsef

On Tue, Jul 19, 2016 at 3:42 PM, Robert Steinke <rsteinke AT uwyo.edu> wrote:
I get a compiler warning "taking address of temporary" when I pup a std::vector<bool>.  There is no warning when I pup std::vector<int>.  I am using charm version 6.6.1 and gcc.  I haven't gotten a chance to test it on the latest version of charm, but there is a simple minimal case that produces the warning so I thought I would pass it along quickly.


Compile this code:


#include <charm++.h>

void my_pup(PUP::er &p)
{
  std::vector<int>  justFine;
  std::vector<bool> troubleMaker;

  p | justFine;
  p | troubleMaker;
}



Get this warning:


In file included from /opt/build/charm/bin/../include/sdag.h:27,
                 from /opt/build/charm/bin/../include/CkMarshall.decl.h:6,
                 from /opt/build/charm/bin/../include/charm++.h:134,
                 from deleteme.cpp:1:
/opt/build/charm/bin/../include/pup_stl.h: In function ‘void PUP::PUP_stl_container_items(PUP::er&, container&) [with container = std::vector<bool, std::allocator<bool> >, dtype = bool]’:
/opt/build/charm/bin/../include/pup_stl.h:156:   instantiated from ‘void PUP::PUP_stl_container(PUP::er&, container&) [with container = std::vector<bool, std::allocator<bool> >, dtype = bool]’
/opt/build/charm/bin/../include/pup_stl.h:179:   instantiated from ‘void PUP::operator|(PUP::er&, std::vector<T, std::allocator<_Tp1> >&) [with T = bool]’
deleteme.cpp:9:   instantiated from here
/opt/build/charm/bin/../include/pup_stl.h:138: warning: taking address of temporary






Archive powered by MHonArc 2.6.16.

Top of Page