g++-mp-4.2 executables bad on leopard?

Chris Waterson waterson at maubi.net
Fri Mar 7 21:41:19 PST 2008


I was poking around at the octave build on Leopard (bug 13686), and
I'm suspicious that g++-mp-4.2 is generating bad executables.

The first snipped below is a simple program that fails in the same way
that "munge-texi" fails in the octave build.  It's simply populating a
std::map from a file with key=value pairs.  Save this as "bug.cc",
them compile with:

   /opt/local/bin/g++-mp-4.2 -g -o bug bug.cc

and then give it a whirl...

   madchenwagen:/tmp$ ./bug
   foo=bar
   baz=bop
   bim=bam
   Segmentation fault
   madchenwagen:/tmp$

Has anyone else seen problems like this?  My weak attempts at googling
turned up nothing that seemed relevant to me.  Just wanted to check
before filing a new bug...

thanks!
chris

---8<-----------------------------------------------------------------

#include <iostream>
#include <map>
#include <string>

static std::map<std::string, std::string> my_map;

int
main(int argc, char* argv[])
{
   while (!std::cin.eof())
   {
     char buf[256];
     std::cin.getline(buf, sizeof buf);

     for (char *c = buf; *c; ++c) {
       if (*c == '=') {
         *c = '\0';
         my_map[buf] = c + 1;
         break;
       }
     }
   }

   return 0;
}




More information about the macports-users mailing list