why this program is wrong on Tru64 OS ?

Discussion in 'C++' started by jose luis fernandez diaz, Nov 25, 2003.

  1. Hi,

    When I run the program below on Tru64:

    #include <string>

    int main()
    {
    char *cad="hola";
    string s1 = 1 ? string(cad, 0, 2) : "";
    }


    I get the next error:

    Unaligned access pid=28959 <a.out> va=0x3ff8000f40c pc=0x1200059c8
    ra=0x120005944 inst=0xa403ffe8
    Resources lost(coredump)


    These are the OS and compiler versions:

    sqocfms01:jdiaz:/tmp>uname -a
    OSF1 sqocfms01.esm.cpqcorp.net V5.1 1885 alpha
    sqocfms01:jdiaz:/tmp>cxx -V
    Compaq C++ V6.3-008 for Compaq Tru64 UNIX V5.1A (Rev. 1885)
    Compiler Driver V6.3-008 (cxx) cxx Driver


    Thands in advance,
    Jose Luis
    jose luis fernandez diaz, Nov 25, 2003
    #1
    1. Advertising

  2. "jose luis fernandez diaz" <> wrote...
    > When I run the program below on Tru64:
    >
    > #include <string>
    >
    > int main()
    > {
    > char *cad="hola";
    > string s1 = 1 ? string(cad, 0, 2) : "";
    > }
    >
    >
    > I get the next error:


    The program is not supposed to compile according to the rules
    of the Standard C++ language. 'string' is supposed to be
    declared in the 'std' namespace.

    >
    > Unaligned access pid=28959 <a.out> va=0x3ff8000f40c pc=0x1200059c8
    > ra=0x120005944 inst=0xa403ffe8
    > Resources lost(coredump)
    >
    >
    > These are the OS and compiler versions:
    >
    > sqocfms01:jdiaz:/tmp>uname -a
    > OSF1 sqocfms01.esm.cpqcorp.net V5.1 1885 alpha
    > sqocfms01:jdiaz:/tmp>cxx -V
    > Compaq C++ V6.3-008 for Compaq Tru64 UNIX V5.1A (Rev. 1885)
    > Compiler Driver V6.3-008 (cxx) cxx Driver


    OS-specific and compiler-specific behaviour cannot be explained from
    the language standpoint, and this newsgroup deals with language only.
    Perhaps you will find more information in a newsgroup dedicated to
    your OS or your compiler.

    IOW, there is nothing in the program itself (except the 'std::' thing)
    that would suggest the alignment problems, and there is nothing in the
    C++ language specification that would help solving your problem.

    Oh, try declaring 'cad' as a pointer to _const_ char:

    char const* cad = "hola";

    (not that it should make much difference, though)

    Victor
    Victor Bazarov, Nov 25, 2003
    #2
    1. Advertising

  3. (jose luis fernandez diaz) wrote in message news:<>...
    > Hi,
    >
    > When I run the program below on Tru64:
    >
    > #include <string>
    >
    > int main()
    > {
    > char *cad="hola";
    > string s1 = 1 ? string(cad, 0, 2) : "";
    > }
    >
    >
    > I get the next error:
    >
    > Unaligned access pid=28959 <a.out> va=0x3ff8000f40c pc=0x1200059c8
    > ra=0x120005944 inst=0xa403ffe8
    > Resources lost(coredump)
    >
    >
    > These are the OS and compiler versions:
    >
    > sqocfms01:jdiaz:/tmp>uname -a
    > OSF1 sqocfms01.esm.cpqcorp.net V5.1 1885 alpha
    > sqocfms01:jdiaz:/tmp>cxx -V
    > Compaq C++ V6.3-008 for Compaq Tru64 UNIX V5.1A (Rev. 1885)
    > Compiler Driver V6.3-008 (cxx) cxx Driver
    >
    >
    > Thands in advance,
    > Jose Luis



    I remember that we had this problem with a Compaq CXX: somehow he doesn't
    get the types correctly. The following should fix your problem
    (not the CXX bug:):

    string s1 = 1 ? std::string(cad, 0, 2) : std::string("");

    In our source we are using the empty string first, but it shouldn't matter,
    please let me know as I do no more have a CXX compiler available.

    Regards, Stephan
    Stephan Br?nnimann, Nov 26, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jose luis fernandez diaz

    Problems installing netforge on Tru64

    jose luis fernandez diaz, Feb 13, 2004, in forum: Java
    Replies:
    0
    Views:
    386
    jose luis fernandez diaz
    Feb 13, 2004
  2. William Rusch

    mod_jk2 compilation issues on tru64 with gcc

    William Rusch, Mar 4, 2004, in forum: C Programming
    Replies:
    2
    Views:
    326
    Old Wolf
    Mar 5, 2004
  3. the_rev_dharma_roadkill

    How to build/install DCOracle2 on tru64 5.1

    the_rev_dharma_roadkill, Jul 27, 2003, in forum: Python
    Replies:
    0
    Views:
    308
    the_rev_dharma_roadkill
    Jul 27, 2003
  4. Heuguette Bostic

    Compiling Python 2-3.4 on Tru64 UNIX V4.0F

    Heuguette Bostic, Sep 7, 2004, in forum: Python
    Replies:
    5
    Views:
    372
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Sep 17, 2004
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,756
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page