djrieger / mjplusplus

A compiler for the MiniJava language
http://djrieger.github.io/mjplusplus/doc/doxygen/html/
6 stars 1 forks source link

Assigning an integer/boolean to a field leads to abort #70

Closed BigPeet closed 9 years ago

BigPeet commented 9 years ago

When compiling the following code snippet, Firm aborts:

B b = new B();        
b.c = 42;

(B has a field int c.)

A a = new A();
a.b = new B();

or

A a = new A();
B b = new B();
a.b = b;

seem to work just fine.

BigPeet commented 9 years ago

Add P64[161:23](A_Mbar[141]): mode of input 'right' different from output mode P64

BigPeet commented 9 years ago

ir_node* addr = new_Add(current_this, FirmInterface::getInstance().createNodeForIntegerConstant(get_entity_offset(field)), mode_P);

is the faulty line. Problem might be that current_this' mode is Is...instead of a mode_P! I don't know why, though.

Nidan commented 9 years ago

I'm looking for the right way(tm) to fix it right now. It doesn't help that firm only sometimes complains about that; the System.out.println construct seems OK...

BigPeet commented 9 years ago

If it helps: When handling b.c the resultNode for visiting the "child"-expression b of the PostfixExpression is already in Is-mode. This is then passed on to the PostfixOpsVisitor and causes the error. I don't know why, though :-(

ratefuchs commented 9 years ago

It seems to be fixed. Can we close this?