Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Aug 2005 04:42:06 +0900
From:      "Tetsuji \"Maverick\" Rai" <maverick31337@vfemail.net>
To:        freebsd-ports@freebsd.org
Subject:   ICC ports has a trouble with ANSI string class which g++ doesn't have (FreeBSD5.4 ICC8.1.032)
Message-ID:  <4314B68E.5070502@vfemail.net>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I minimized this problem to a small test case.  Compile this simple
program and compile and run, you'll find the problem as follows:

testcase code.
- ----t1.cpp------
#include <ctype.h>
#include <iostream>
#include <string>

// convert every character to lower case
void downcase_string(std::string& w) {
    std::transform(w.begin(), w.end(), w.begin(), (int(*)(int))tolower);
}


int main(int argc, char** argv){

  if(argc != 2){
    fprintf(stderr, "Usage: %s <string>\n", argv[0]);
    exit(1);
  }

  std::string fn = argv[1];
  downcase_string(fn);

  std::cout << fn << std::endl;

  return 0;
}
- ----------------
If it's compiled with g++ it succeeds as follows:

- ---------
freebsd54:~/tmp% g++ -o t1-gcc t1.cpp
freebsd54:~/tmp% ./t1-gcc aAAAa
aaaaa
freebsd54:~/tmp%
- ----------

However if it's compiled with icpc, it fails and dumps core:

- ----------
freebsd54:~/tmp% icpc -o t1-icc t1.cpp
freebsd54:~/tmp% ./t1-icc aAAAa
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_S_create
zsh: abort (core dumped)  ./t1-icc aAAAa
- -----------

what's the problem and how can I fix it?

TIA

- --
Tetsuji 'Maverick' Rai
PGP Key fingerprint = 2021 6BF9 CEA3 73DE FF17  B326 F4DA F04E F784 3B85
gpg fingerprint
Aviation Jokes: http://www.geocities.com/tetsuji_rai/
Profile http://maverick.ns1.name/
http://maverick.IsASecret.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDFLaO9NrwTveEO4URAslpAKCF1ka8BlDKbMePvdl/4rQRBomccQCdEx2d
iYAGpB/2ENK+yI6fiJRz0kA=
=DS2b
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4314B68E.5070502>