Bit Problem I met with IAR's C++ Compiler

S

Steven Woody

i am using IAR's C++ compiler for M16C target. i found many things with this
product are very strange. i hope someone here can use his experience with the
language and compiler to help me find a clue.

1, Parameter can not be passed into class method.

class Foo {
public:
void paraTest(const int i)
{
if ( i == 500 )
beep();
}
};

so i call the paraTest with foo.paraTest(500) and expect a beep. but, nothing
happened! (my beep function has no problem because it can beep in other place)

2, static initializable data will simply disappear

in one cpp file's outest scope, i have,

static int intArray[5] = {1, 2, 3, 4, 5};

but, once i defined this kind of data, the program would halt. i then checked
the generated map file and found initialization data segment has a size of
zero!

however, if i reference the intArray in some place of the program ( in the main
function), the program will run normally and won't halt. i have already turned
off any option about optimization.

3, the program can only compiled in Far data mode if i use STL

a simple declare of std::string will cause the program crash if i compile the
program in NEAR data mode. but it seems ok if i compiled it in FAR data model.


In my whole experience of programming, i never ever met phenomena like
above. any help will be highly appreciated!



--
steven woody (id: narke)

Virginia Woolf: Someone has to die Leonard, in order that the rest of
us should value our life more.

- The Hours (2002)
 
M

mlimber

Steven said:
i am using IAR's C++ compiler for M16C target. i found many things with this
product are very strange. i hope someone here can use his experience with the
language and compiler to help me find a clue.

1, Parameter can not be passed into class method.

class Foo {
public:
void paraTest(const int i)
{
if ( i == 500 )
beep();
}
};

so i call the paraTest with foo.paraTest(500) and expect a beep. but, nothing
happened! (my beep function has no problem because it can beep in other place)

2, static initializable data will simply disappear

in one cpp file's outest scope, i have,

static int intArray[5] = {1, 2, 3, 4, 5};

but, once i defined this kind of data, the program would halt. i then checked
the generated map file and found initialization data segment has a size of
zero!

however, if i reference the intArray in some place of the program ( in the main
function), the program will run normally and won't halt. i have already turned
off any option about optimization.

3, the program can only compiled in Far data mode if i use STL

a simple declare of std::string will cause the program crash if i compile the
program in NEAR data mode. but it seems ok if i compiled it in FAR data model.


In my whole experience of programming, i never ever met phenomena like
above. any help will be highly appreciated!



--
steven woody (id: narke)

Virginia Woolf: Someone has to die Leonard, in order that the rest of
us should value our life more.

- The Hours (2002)

I don't have any experience with this compiler, but it sounds like it
is non-conformant, buggy, or both. Hence, your post is unfortunately
off-topic here since this newsgroup is for standard C++ language
discussions rather than compiler-specific questions, and you'll have to
either talk to your vendor or post in a more relevant newsgroup.

See the FAQ for what is on-topic and for some suggestions on which
other groups you can try:
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9 .

Cheers! --M
 
V

Victor Bazarov

Steven said:
i am using IAR's C++ compiler for M16C target. i found many things with this
product are very strange. i hope someone here can use his experience with the
language and compiler to help me find a clue.

[...]

First off, have you tried contacting their technical support? If yes,
what (if anything) did they say? If not, why not?

V
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top